@@ -42,51 +42,7 @@ extension URLCache {
42
42
It is used to maintain characteristics and attributes of a cached
43
43
object.
44
44
*/
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 {
90
46
open override func copy( ) -> Any {
91
47
return copy ( with: nil )
92
48
}
0 commit comments