Skip to content

Commit cc313da

Browse files
author
Itai Ferber
committed
NSKeyedUnarchiver methods should take Data
We missed a few NSKeyedUnarchiver methods during our original renaming for Swift — some of these methods still take NSData when they can take Data. We can add Data variants which bridge to NSData to fix this in a backwards-compatible way.
1 parent c34d269 commit cc313da

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

stdlib/public/SDK/Foundation/NSCoder.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ extension NSKeyedUnarchiver {
144144
return result as AnyObject?
145145
}
146146

147+
@nonobjc
148+
@available(swift, obsoleted: 4)
149+
@available(OSX 10.11, iOS 9.0, *)
150+
public class func unarchiveTopLevelObjectWithData(_ data: Data) throws -> AnyObject? {
151+
return try self.unarchiveTopLevelObjectWithData(data as NSData)
152+
}
153+
147154
@nonobjc
148155
@available(swift, introduced: 4)
149156
@available(OSX 10.11, iOS 9.0, *)
@@ -153,6 +160,13 @@ extension NSKeyedUnarchiver {
153160
try resolveError(error)
154161
return result
155162
}
163+
164+
@nonobjc
165+
@available(swift, introduced: 4)
166+
@available(OSX 10.11, iOS 9.0, *)
167+
public class func unarchiveTopLevelObjectWithData(_ data: Data) throws -> Any? {
168+
return try self.unarchiveTopLevelObjectWithData(data as NSData)
169+
}
156170
}
157171

158172

0 commit comments

Comments
 (0)