@@ -47,51 +47,7 @@ extension URLCache {
47
47
It is used to maintain characteristics and attributes of a cached
48
48
object.
49
49
*/
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 {
95
51
open override func copy( ) -> Any {
96
52
return copy ( with: nil )
97
53
}
0 commit comments