Skip to content
This repository was archived by the owner on Jun 4, 2021. It is now read-only.

Commit 7eb8fe9

Browse files
committed
Changed AnyObject to Any
1 parent b616855 commit 7eb8fe9

38 files changed

+159
-156
lines changed

Sources/Bridging.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public protocol _OCKBridgable {
1515

1616
public protocol CKNumberValueType: CKRecordValue {}
1717
extension CKNumberValueType where Self: _OCKBridgable, Self.ObjectType == NSNumber {
18-
public var recordFieldDictionary: [String: AnyObject] {
18+
public var recordFieldDictionary: [String: Any] {
1919
return ["value": self.bridge()]
2020
}
2121
}
@@ -77,7 +77,7 @@ extension Double: _OCKBridgable {
7777
}
7878

7979
extension NSDictionary {
80-
public func bridge() -> [NSObject: AnyObject] {
80+
public func bridge() -> [NSObject: Any] {
8181
return self as [NSObject: AnyObject]
8282
}
8383
}

Sources/CKAcceptSharesOperation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class CKAcceptSharesOperation: CKOperation {
3838
case .success(let dictionary):
3939

4040
// Process Records
41-
if let resultsDictionary = dictionary["results"] as? [[String: AnyObject]] {
41+
if let resultsDictionary = dictionary["results"] as? [[String: Any]] {
4242
// Parse JSON into CKRecords
4343
for resultDictionary in resultsDictionary {
4444
if let shareMetadata = CKShareMetadata(dictionary: resultDictionary) {

Sources/CKAcceptSharesURLRequest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class CKAcceptSharesURLRequest: CKURLRequest {
1919
self.path = "accept"
2020
self.operationType = CKOperationRequestType.records
2121

22-
var parameters: [String: AnyObject] = [:]
22+
var parameters: [String: Any] = [:]
2323

2424
parameters["shortGUIDs"] = shortGUIDs.map({ (guid) -> NSDictionary in
2525
return guid.dictionary.bridge()

Sources/CKAsset.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class CKAsset: NSObject {
4444
self.fileURL = fileURL
4545
}
4646

47-
init?(dictionary: [String: AnyObject]) {
47+
init?(dictionary: [String: Any]) {
4848

4949
guard
5050
let downloadURL = dictionary["downloadURL"] as? String,

Sources/CKContainerConfig.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public struct CKConfig {
2525
self.containers = [container]
2626
}
2727

28-
init?(dictionary: [String: AnyObject], workingDirectory: String?) {
29-
guard let containerDictionaries = dictionary["containers"] as? [[String: AnyObject]] else {
28+
init?(dictionary: [String: Any], workingDirectory: String?) {
29+
guard let containerDictionaries = dictionary["containers"] as? [[String: Any]] else {
3030
return nil
3131
}
3232

@@ -53,7 +53,7 @@ public struct CKConfig {
5353

5454
let jsonData = try NSData(contentsOfFile: path, options: [])
5555

56-
if let dictionary = try JSONSerialization.jsonObject(with: jsonData.bridge(), options: []) as? [String: AnyObject] {
56+
if let dictionary = try JSONSerialization.jsonObject(with: jsonData.bridge(), options: []) as? [String: Any] {
5757
self.init(dictionary: dictionary, workingDirectory: directory.path)!
5858
} else {
5959
throw CKConfigError.InvalidJSON
@@ -102,15 +102,15 @@ public struct CKContainerConfig {
102102

103103
let apnsEnvironment = CKEnvironment(rawValue: dictionary["apnsEnvironment"] as? String ?? "")
104104

105-
if let apiTokenAuthDictionary = dictionary["apiTokenAuth"] as? [String: AnyObject] {
105+
if let apiTokenAuthDictionary = dictionary["apiTokenAuth"] as? [String: Any] {
106106

107107
if let apiToken = apiTokenAuthDictionary["apiToken"] as? String {
108108
self.init(containerIdentifier: containerIdentifier, environment: environment, apiTokenAuth: apiToken, apnsEnvironment: apnsEnvironment)
109109
} else {
110110
return nil
111111
}
112112

113-
} else if let serverToServerKeyAuthDictionary = dictionary["serverToServerKeyAuth"] as? [String: AnyObject] {
113+
} else if let serverToServerKeyAuthDictionary = dictionary["serverToServerKeyAuth"] as? [String: Any] {
114114
guard let keyID = serverToServerKeyAuthDictionary["keyID"] as? String, let privateKeyFile = serverToServerKeyAuthDictionary["privateKeyFile"] as? String else {
115115
return nil
116116
}

Sources/CKDictionaryValue.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,47 @@
99
import Foundation
1010
/*
1111
protocol CKDictionaryValue {
12-
func toObject() -> AnyObject?
12+
func toObject() -> Any?
1313
}
1414

1515
extension String: CKDictionaryValue {
16-
func toObject() -> AnyObject? {
16+
func toObject() -> Any? {
1717
return self.bridge()
1818
}
1919
}
2020

2121
extension Int: CKDictionaryValue {
22-
func toObject() -> AnyObject? {
22+
func toObject() -> Any? {
2323
return NSNumber(value: self)
2424
}
2525
}
2626
extension Double: CKDictionaryValue {
27-
func toObject() -> AnyObject? {
27+
func toObject() -> Any? {
2828
return NSNumber(value: self)
2929
}
3030
}
3131

3232
extension Float: CKDictionaryValue {
33-
func toObject() -> AnyObject? {
33+
func toObject() -> Any? {
3434
return NSNumber(value: self)
3535
}
3636
}
3737

3838
extension Bool: CKDictionaryValue {
39-
func toObject() -> AnyObject? {
39+
func toObject() -> Any? {
4040
return NSNumber(value: self)
4141
}
4242
}
4343

4444
extension Array: CKDictionaryValue {
45-
func toObject() -> AnyObject? {
46-
return self.bridge() as? AnyObject
45+
func toObject() -> Any? {
46+
return self.bridge() as? Any
4747
}
4848
}
4949

5050
extension Dictionary where Key: StringLiteralConvertible, Value: CKDictionaryValue {
51-
func toObject() -> AnyObject? {
52-
var dictionary: [String: AnyObject] = [:]
51+
func toObject() -> Any? {
52+
var dictionary: [String: Any] = [:]
5353

5454
for (key, value) in dictionary {
5555
dictionary[key] = value.toObject()

Sources/CKDiscoverAllUserIdentitiesOperation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class CKDiscoverAllUserIdentitiesOperation : CKOperation {
4747
return
4848
} else if let dictionary = dictionary {
4949
// Process Records
50-
if let userDictionaries = dictionary["users"] as? [[String: AnyObject]] {
50+
if let userDictionaries = dictionary["users"] as? [[String: Any]] {
5151
// Parse JSON into CKRecords
5252
for userDictionary in userDictionaries {
5353

Sources/CKDiscoverUserIdentitiesOperation.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class CKDiscoverUserIdentitiesOperation : CKOperation {
4242
return lookupInfo.dictionary
4343
}
4444

45-
let request: [String: AnyObject] = ["lookupInfos": lookUpInfos.bridge() as AnyObject]
45+
let request: [String: Any] = ["lookupInfos": lookUpInfos.bridge() as Any]
4646

4747
urlSessionTask = CKWebRequest(container: operationContainer).request(withURL: url, parameters: request) { (dictionary, error) in
4848

@@ -58,7 +58,7 @@ public class CKDiscoverUserIdentitiesOperation : CKOperation {
5858
return
5959
} else if let dictionary = dictionary {
6060
// Process Records
61-
if let userDictionaries = dictionary["users"] as? [[String: AnyObject]] {
61+
if let userDictionaries = dictionary["users"] as? [[String: Any]] {
6262
// Parse JSON into CKRecords
6363
for userDictionary in userDictionaries {
6464

Sources/CKFetchErrorDictionary.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Foundation
1010

1111
protocol CKFetchErrorDictionaryIdentifier {
12-
init?(dictionary: [String: AnyObject])
12+
init?(dictionary: [String: Any])
1313

1414
static var identifierKey: String { get }
1515
}
@@ -29,7 +29,7 @@ struct CKErrorDictionary {
2929
let redirectURL: String?
3030
let uuid: String
3131

32-
init?(dictionary: [String: AnyObject]) {
32+
init?(dictionary: [String: Any]) {
3333

3434
guard
3535
let uuid = dictionary["uuid"] as? String,
@@ -53,7 +53,7 @@ struct CKErrorDictionary {
5353

5454
let errorCode = CKErrorCode.errorCode(serverError: serverErrorCode)!
5555

56-
var userInfo: NSErrorUserInfoType = [NSLocalizedDescriptionKey: reason.bridge() as AnyObject, "serverErrorCode": serverErrorCode.bridge() as AnyObject]
56+
var userInfo: NSErrorUserInfoType = [NSLocalizedDescriptionKey: reason.bridge() as Any, "serverErrorCode": serverErrorCode.bridge() as Any]
5757
if let redirectURL = redirectURL {
5858
userInfo[CKErrorRedirectURLKey] = redirectURL.bridge()
5959
}
@@ -74,10 +74,10 @@ struct CKFetchErrorDictionary<T: CKFetchErrorDictionaryIdentifier> {
7474
let retryAfter: NSNumber?
7575
let redirectURL: String?
7676

77-
init?(dictionary: [String: AnyObject]) {
77+
init?(dictionary: [String: Any]) {
7878

7979
guard
80-
let identifier = T(dictionary: dictionary[T.identifierKey] as? [String: AnyObject] ?? [:]),
80+
let identifier = T(dictionary: dictionary[T.identifierKey] as? [String: Any] ?? [:]),
8181
let reason = dictionary[CKRecordFetchErrorDictionary.reasonKey] as? String,
8282
let serverErrorCode = dictionary[CKRecordFetchErrorDictionary.serverErrorCodeKey] as? String
8383
else {
@@ -98,7 +98,7 @@ struct CKFetchErrorDictionary<T: CKFetchErrorDictionaryIdentifier> {
9898

9999
let errorCode = CKErrorCode.errorCode(serverError: serverErrorCode)!
100100

101-
var userInfo: NSErrorUserInfoType = [NSLocalizedDescriptionKey: reason.bridge() as AnyObject, "serverErrorCode": serverErrorCode.bridge() as AnyObject]
101+
var userInfo: NSErrorUserInfoType = [NSLocalizedDescriptionKey: reason.bridge() as Any, "serverErrorCode": serverErrorCode.bridge() as Any]
102102
if let redirectURL = redirectURL {
103103
userInfo[CKErrorRedirectURLKey] = redirectURL.bridge()
104104
}

Sources/CKFetchRecordZonesOperation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public class CKFetchRecordZonesOperation : CKDatabaseOperation {
7979
return
8080
} else if let dictionary = dictionary {
8181
// Process Records
82-
if let zoneDictionaries = dictionary["zones"] as? [[String: AnyObject]] {
82+
if let zoneDictionaries = dictionary["zones"] as? [[String: Any]] {
8383
// Parse JSON into CKRecords
8484
for zoneDictionary in zoneDictionaries {
8585

Sources/CKFetchRecordsOperation.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class CKFetchRecordsOperation: CKDatabaseOperation {
1212

1313
var isFetchCurrentUserOperation = false
1414

15-
var recordErrors: [String: AnyObject] = [:]
15+
var recordErrors: [String: Any] = [:]
1616

1717
var shouldFetchAssetContent: Bool = false
1818

@@ -43,8 +43,8 @@ public class CKFetchRecordsOperation: CKDatabaseOperation {
4343
// Generate the CKOperation Web Service URL
4444
let url = "\(operationURL)/records/\(CKRecordOperation.lookup)"
4545

46-
var request: [String: AnyObject] = [:]
47-
let lookupRecords = recordIDs?.map { (recordID) -> [String: AnyObject] in
46+
var request: [String: Any] = [:]
47+
let lookupRecords = recordIDs?.map { (recordID) -> [String: Any] in
4848
return ["recordName": recordID.recordName.bridge()]
4949
}
5050

@@ -63,7 +63,7 @@ public class CKFetchRecordsOperation: CKDatabaseOperation {
6363
self.fetchRecordsCompletionBlock?(nil, error)
6464
} else if let dictionary = dictionary {
6565
// Process Records
66-
if let recordsDictionary = dictionary["records"] as? [[String: AnyObject]] {
66+
if let recordsDictionary = dictionary["records"] as? [[String: Any]] {
6767
// Parse JSON into CKRecords
6868
for (index,recordDictionary) in recordsDictionary.enumerated() {
6969

Sources/CKFetchSubscriptionsOperation.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class CKFetchSubscriptionsOperation : CKDatabaseOperation {
3737

3838
let url = "\(operationURL)/subscriptions/lookup"
3939

40-
var request: [String: AnyObject] = [:]
40+
var request: [String: Any] = [:]
4141
if let subscriptionIDs = subscriptionIDs {
4242

4343
request["subscriptions"] = subscriptionIDs.bridge()
@@ -51,7 +51,7 @@ public class CKFetchSubscriptionsOperation : CKDatabaseOperation {
5151

5252
} else if let dictionary = dictionary {
5353

54-
if let subscriptionsDictionary = dictionary["subscriptions"] as? [[String: AnyObject]] {
54+
if let subscriptionsDictionary = dictionary["subscriptions"] as? [[String: Any]] {
5555
// Parse JSON into CKRecords
5656
var subscriptionsIDToSubscriptions: [String: CKSubscription] = [:]
5757
var subscriptionErrorIDs: [String: NSError] = [:]

Sources/CKModifyRecordZonesOperation.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ public class CKModifyRecordZonesOperation : CKDatabaseOperation {
4040
*/
4141
public var modifyRecordZonesCompletionBlock: (([CKRecordZone]?, [CKRecordZoneID]?, NSError?) -> Swift.Void)?
4242

43-
func zoneOperations() -> [[String: AnyObject]] {
43+
func zoneOperations() -> [[String: Any]] {
4444

45-
var operationDictionaries: [[String: AnyObject]] = []
45+
var operationDictionaries: [[String: Any]] = []
4646
if let recordZonesToSave = recordZonesToSave {
47-
let saveOperations = recordZonesToSave.map({ (zone) -> [String: AnyObject] in
47+
let saveOperations = recordZonesToSave.map({ (zone) -> [String: Any] in
4848

49-
let operation: [String: AnyObject] = [
49+
let operation: [String: Any] = [
5050
"operationType": "create".bridge(),
51-
"zone": ["zoneID".bridge(): zone.zoneID.dictionary].bridge() as AnyObject
51+
"zone": ["zoneID".bridge(): zone.zoneID.dictionary].bridge() as Any
5252
]
5353

5454
return operation
@@ -58,11 +58,11 @@ public class CKModifyRecordZonesOperation : CKDatabaseOperation {
5858
}
5959

6060
if let recordZoneIDsToDelete = recordZoneIDsToDelete {
61-
let deleteOperations = recordZoneIDsToDelete.map({ (zoneID) -> [String: AnyObject] in
61+
let deleteOperations = recordZoneIDsToDelete.map({ (zoneID) -> [String: Any] in
6262

63-
let operation: [String: AnyObject] = [
63+
let operation: [String: Any] = [
6464
"operationType": "delete".bridge(),
65-
"zone": ["zoneID".bridge(): zoneID.dictionary.bridge()].bridge() as AnyObject
65+
"zone": ["zoneID".bridge(): zoneID.dictionary.bridge()].bridge() as Any
6666
]
6767

6868
return operation
@@ -79,7 +79,7 @@ public class CKModifyRecordZonesOperation : CKDatabaseOperation {
7979
let url = "\(databaseURL)/zones/modify"
8080
let zoneOperations = self.zoneOperations().bridge()
8181

82-
let request: [String: AnyObject] = ["operations": zoneOperations]
82+
let request: [String: Any] = ["operations": zoneOperations]
8383

8484
urlSessionTask = CKWebRequest(container: operationContainer).request(withURL: url, parameters: request) { (dictionary, error) in
8585

@@ -94,7 +94,7 @@ public class CKModifyRecordZonesOperation : CKDatabaseOperation {
9494
return
9595
} else if let dictionary = dictionary {
9696
// Process Records
97-
if let zoneDictionaries = dictionary["zones"] as? [[String: AnyObject]] {
97+
if let zoneDictionaries = dictionary["zones"] as? [[String: Any]] {
9898
// Parse JSON into CKRecords
9999
for zoneDictionary in zoneDictionaries {
100100

Sources/CKModifyRecordsOperation.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct CKSubscriptionFetchErrorDictionary {
3636

3737
let redirectURL: String?
3838

39-
init?(dictionary: [String: AnyObject]) {
39+
init?(dictionary: [String: Any]) {
4040
guard
4141
let subscriptionID = dictionary[CKSubscriptionFetchErrorDictionary.subscriptionIDKey] as? String,
4242
let reason = dictionary[CKSubscriptionFetchErrorDictionary.reasonKey] as? String,
@@ -156,7 +156,7 @@ public class CKModifyRecordsOperation: CKDatabaseOperation {
156156
case .success(let dictionary):
157157

158158
// Process Records
159-
if let recordsDictionary = dictionary["records"] as? [[String: AnyObject]] {
159+
if let recordsDictionary = dictionary["records"] as? [[String: Any]] {
160160
// Parse JSON into CKRecords
161161
for recordDictionary in recordsDictionary {
162162

@@ -216,7 +216,7 @@ public class CKModifyRecordsOperation: CKDatabaseOperation {
216216

217217
} else if let dictionary = dictionary {
218218
// Process Records
219-
if let recordsDictionary = dictionary["records"] as? [[String: AnyObject]] {
219+
if let recordsDictionary = dictionary["records"] as? [[String: Any]] {
220220
// Parse JSON into CKRecords
221221
for recordDictionary in recordsDictionary {
222222

0 commit comments

Comments
 (0)