Skip to content

Commit 6be80a7

Browse files
committed
Remove coding.
1 parent a6e23cf commit 6be80a7

File tree

1 file changed

+1
-45
lines changed

1 file changed

+1
-45
lines changed

Foundation/URLCache.swift

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -47,51 +47,7 @@ extension URLCache {
4747
It is used to maintain characteristics and attributes of a cached
4848
object.
4949
*/
50-
open class CachedURLResponse : NSObject, NSSecureCoding, NSCopying {
51-
52-
public required init?(coder aDecoder: NSCoder) {
53-
guard aDecoder.allowsKeyedCoding else {
54-
/* Unkeyed unarchiving is not supported. */
55-
return nil
56-
}
57-
58-
guard let data = aDecoder.decodeObject(of: NSData.self, forKey: "Data") else {
59-
return nil
60-
}
61-
guard let response = aDecoder.decodeObject(of: URLResponse.self, forKey: "URLResponse") else {
62-
return nil
63-
}
64-
guard let storagePolicyValue = aDecoder.decodeObject(of: NSNumber.self, forKey: "StoragePolicy") else {
65-
return nil
66-
}
67-
guard let storagePolicy = URLCache.StoragePolicy(rawValue: storagePolicyValue.uintValue) else {
68-
return nil
69-
}
70-
let userInfo = aDecoder.decodeObject(of: NSDictionary.self, forKey: "UserInfo")
71-
72-
self.data = data as Data
73-
self.response = response
74-
self.storagePolicy = storagePolicy
75-
self.userInfo = userInfo?._swiftObject
76-
}
77-
78-
open func encode(with aCoder: NSCoder) {
79-
guard aCoder.allowsKeyedCoding else {
80-
fatalError("We do not support saving to a non-keyed coder.")
81-
}
82-
83-
aCoder.encode(data as NSData, forKey: "Data")
84-
aCoder.encode(response, forKey: "URLResponse")
85-
aCoder.encode(NSNumber(value: storagePolicy.rawValue), forKey: "StoragePolicy")
86-
if let userInfo = userInfo {
87-
aCoder.encode(userInfo._nsObject, forKey: "UserInfo")
88-
}
89-
}
90-
91-
static public var supportsSecureCoding: Bool {
92-
return true
93-
}
94-
50+
open class CachedURLResponse : NSObject, NSCopying {
9551
open override func copy() -> Any {
9652
return copy(with: nil)
9753
}

0 commit comments

Comments
 (0)