Skip to content

Commit 5e0718f

Browse files
committed
Remove coding.
1 parent 7eff965 commit 5e0718f

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
@@ -42,51 +42,7 @@ extension URLCache {
4242
It is used to maintain characteristics and attributes of a cached
4343
object.
4444
*/
45-
open class CachedURLResponse : NSObject, NSSecureCoding, NSCopying {
46-
47-
public required init?(coder aDecoder: NSCoder) {
48-
guard aDecoder.allowsKeyedCoding else {
49-
/* Unkeyed unarchiving is not supported. */
50-
return nil
51-
}
52-
53-
guard let data = aDecoder.decodeObject(of: NSData.self, forKey: "Data") else {
54-
return nil
55-
}
56-
guard let response = aDecoder.decodeObject(of: URLResponse.self, forKey: "URLResponse") else {
57-
return nil
58-
}
59-
guard let storagePolicyValue = aDecoder.decodeObject(of: NSNumber.self, forKey: "StoragePolicy") else {
60-
return nil
61-
}
62-
guard let storagePolicy = URLCache.StoragePolicy(rawValue: storagePolicyValue.uintValue) else {
63-
return nil
64-
}
65-
let userInfo = aDecoder.decodeObject(of: NSDictionary.self, forKey: "UserInfo")
66-
67-
self.data = data as Data
68-
self.response = response
69-
self.storagePolicy = storagePolicy
70-
self.userInfo = userInfo?._swiftObject
71-
}
72-
73-
open func encode(with aCoder: NSCoder) {
74-
guard aCoder.allowsKeyedCoding else {
75-
fatalError("We do not support saving to a non-keyed coder.")
76-
}
77-
78-
aCoder.encode(data as NSData, forKey: "Data")
79-
aCoder.encode(response, forKey: "URLResponse")
80-
aCoder.encode(NSNumber(value: storagePolicy.rawValue), forKey: "StoragePolicy")
81-
if let userInfo = userInfo {
82-
aCoder.encode(userInfo._nsObject, forKey: "UserInfo")
83-
}
84-
}
85-
86-
static public var supportsSecureCoding: Bool {
87-
return true
88-
}
89-
45+
open class CachedURLResponse : NSObject, NSCopying {
9046
open override func copy() -> Any {
9147
return copy(with: nil)
9248
}

0 commit comments

Comments
 (0)