Skip to content

Foundation: stop exporting certain overlay methods to Objective-C #3779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 27, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions stdlib/public/SDK/Foundation/Foundation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ extension NSArray {
///
/// Discussion: After an immutable array has been initialized in
/// this way, it cannot be modified.
@objc(_swiftInitWithArray_NSArray:)
@nonobjc
public convenience init(array anArray: NSArray) {
self.init(array: anArray as Array)
}
Expand All @@ -1222,7 +1222,7 @@ extension NSString {
/// - Returns: An `NSString` object initialized by copying the
/// characters from `aString`. The returned object may be different
/// from the original receiver.
@objc(_swiftInitWithString_NSString:)
@nonobjc
public convenience init(string aString: NSString) {
self.init(string: aString as String)
}
Expand All @@ -1235,7 +1235,7 @@ extension NSSet {
/// - Returns: An initialized objects set containing the objects from
/// `set`. The returned set might be different than the original
/// receiver.
@objc(_swiftInitWithSet_NSSet:)
@nonobjc
public convenience init(set anSet: NSSet) {
// FIXME: This is a bit weird. Maybe there's a better way?
self.init(set: anSet as Set<NSObject> as Set<AnyHashable>)
Expand Down Expand Up @@ -1354,6 +1354,7 @@ extension NSCoder {
return NS_Swift_NSCoder_decodeObjectOfClassesForKey(self as AnyObject, classesAsNSObjects, key as AnyObject, nil).map { $0 as Any }
}

@nonobjc
@available(OSX 10.11, iOS 9.0, *)
public func decodeTopLevelObject() throws -> Any? {
var error: NSError?
Expand All @@ -1367,6 +1368,7 @@ extension NSCoder {
fatalError("This API has been renamed")
}

@nonobjc
@available(OSX 10.11, iOS 9.0, *)
public func decodeTopLevelObject(forKey key: String) throws -> AnyObject? {
var error: NSError?
Expand Down Expand Up @@ -1394,11 +1396,13 @@ extension NSCoder {
return result as? DecodedObjectType
}

@nonobjc
@available(*, unavailable, renamed: "decodeTopLevelObject(of:forKey:)")
public func decodeTopLevelObjectOfClasses(_ classes: NSSet?, forKey key: String) throws -> AnyObject? {
fatalError("This API has been renamed")
}

@nonobjc
@available(OSX 10.11, iOS 9.0, *)
public func decodeTopLevelObject(of classes: [AnyClass]?, forKey key: String) throws -> Any? {
var error: NSError? = nil
Expand All @@ -1424,6 +1428,7 @@ internal func NS_Swift_NSKeyedUnarchiver_unarchiveObjectWithData(

extension NSKeyedUnarchiver {
@available(OSX 10.11, iOS 9.0, *)
@nonobjc
public class func unarchiveTopLevelObjectWithData(_ data: NSData) throws -> AnyObject? {
var error: NSError?
let result = NS_Swift_NSKeyedUnarchiver_unarchiveObjectWithData(self, data as AnyObject, &error)
Expand Down