Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 8e8dfd0

Browse files
committed
Merge branch 'release/3.12.0'
2 parents f8302e7 + 714d976 commit 8e8dfd0

29 files changed

+688
-449
lines changed

Cartfile.resolved

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
github "DaveWoodCom/XCGLogger" "6.0.1"
1+
github "DaveWoodCom/XCGLogger" "6.0.2"
22
github "Hearst-DD/ObjectMapper" "3.1.0"
3-
github "Quick/Nimble" "v7.0.2"
3+
github "Quick/Nimble" "v7.0.3"
44
github "glock45/swifter" "1.3.3"
55
github "kif-framework/KIF" "v3.6.0"
66
github "kishikawakatsumi/KeychainAccess" "v3.1.0"
77
github "mxcl/PromiseKit" "4.5.0"
88
github "pubnub/objective-c" "v4.7.4"
99
github "realm/realm-cocoa" "v3.0.2"
10-
github "tjboneman/NSPredicate-MongoDB-Adaptor" "2b48b18d32ee6d0d9050725452277e704c4de1d4"
10+
github "tjboneman/NSPredicate-MongoDB-Adaptor" "3659f0846c983498c34310de21773f29668b2bd0"

Carthage/Checkouts/NSPredicate-MongoDB-Adaptor/MongoDBPredicateAdaptor.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,12 @@ extension NSPredicate {
310310
keyPathConstantTuple.keyPathExpression.keyPath.hasSuffix(".@count")
311311
{
312312
var keyPath = keyPathConstantTuple.keyPathExpression.keyPath
313-
keyPath = String(keyPath[...keyPath.index(keyPath.endIndex, offsetBy: -(".@count".characters.count) - 1)])
313+
#if swift(>=4.0)
314+
let countOffset = ".@count".count
315+
#else
316+
let countOffset = ".@count".characters.count
317+
#endif
318+
keyPath = String(keyPath[...keyPath.index(keyPath.endIndex, offsetBy: -countOffset - 1)])
314319
let value = transform(constant: keyPathConstantTuple.constantValueExpression.constantValue, modifyingOperator: &`operator`)
315320
return [keyPath : ["$size" : value]]
316321
}

Kinvey.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "Kinvey"
19-
s.version = "3.11.0"
19+
s.version = "3.12.0"
2020
s.summary = "Kinvey iOS SDK"
2121

2222
# This description is used to generate tags and improve search results.

Kinvey/Kinvey.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
573E55F11CAC8BA8003D2F23 /* CustomEndpointTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 573E55F01CAC8BA8003D2F23 /* CustomEndpointTests.swift */; };
6969
57403A7D1C4D92E3008ECCD4 /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57403A7C1C4D92E3008ECCD4 /* Error.swift */; };
7070
5745DC821C97904400E7E764 /* Kinvey.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 57A27C811C178F17000DF951 /* Kinvey.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
71+
57465B3B1F956E5E007F86C7 /* PullDataStoreViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57465B3A1F956E5E007F86C7 /* PullDataStoreViewController.swift */; };
7172
57470FA11C76834B0096B15F /* ReadOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57470FA01C76834B0096B15F /* ReadOperation.swift */; };
7273
57470FA31C76847F0096B15F /* WriteOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57470FA21C76847F0096B15F /* WriteOperation.swift */; };
7374
57470FA51C76926B0096B15F /* PushOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57470FA41C76926B0096B15F /* PushOperation.swift */; };
@@ -260,6 +261,7 @@
260261
579D308D1DDA68950055C8CF /* KIF.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57B0C1D21CDCE88900492D6C /* KIF.framework */; };
261262
579D30921DDA6FF30055C8CF /* KIF.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 57B0C1D21CDCE88900492D6C /* KIF.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
262263
579D30931DDA6FF80055C8CF /* KIF.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 57B0C1D21CDCE88900492D6C /* KIF.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
264+
57A1E7422008877E00B19CFB /* Options.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57A1E7412008877E00B19CFB /* Options.swift */; };
263265
57A27C851C178F17000DF951 /* Kinvey.h in Headers */ = {isa = PBXBuildFile; fileRef = 57A27C841C178F17000DF951 /* Kinvey.h */; settings = {ATTRIBUTES = (Public, ); }; };
264266
57A27C8C1C178F18000DF951 /* Kinvey.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57A27C811C178F17000DF951 /* Kinvey.framework */; };
265267
57A27C911C178F18000DF951 /* KinveyTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57A27C901C178F18000DF951 /* KinveyTestCase.swift */; };
@@ -860,6 +862,7 @@
860862
573DD9841D11CCD6006ECF1C /* RealmCache.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmCache.swift; sourceTree = "<group>"; };
861863
573E55F01CAC8BA8003D2F23 /* CustomEndpointTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomEndpointTests.swift; sourceTree = "<group>"; };
862864
57403A7C1C4D92E3008ECCD4 /* Error.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Error.swift; sourceTree = "<group>"; };
865+
57465B3A1F956E5E007F86C7 /* PullDataStoreViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PullDataStoreViewController.swift; sourceTree = "<group>"; };
863866
57470FA01C76834B0096B15F /* ReadOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReadOperation.swift; sourceTree = "<group>"; };
864867
57470FA21C76847F0096B15F /* WriteOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WriteOperation.swift; sourceTree = "<group>"; };
865868
57470FA41C76926B0096B15F /* PushOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PushOperation.swift; sourceTree = "<group>"; };
@@ -956,6 +959,7 @@
956959
578F5C921C99EED100B20F17 /* KIF.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KIF.swift; sourceTree = "<group>"; };
957960
5793B8991D2306A60088B5F9 /* KinveyTests Encrypted.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "KinveyTests Encrypted.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
958961
5795AB011DD136B8001FC808 /* NoCacheTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NoCacheTestCase.swift; sourceTree = "<group>"; };
962+
57A1E7412008877E00B19CFB /* Options.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Options.swift; sourceTree = "<group>"; };
959963
57A27C811C178F17000DF951 /* Kinvey.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Kinvey.framework; sourceTree = BUILT_PRODUCTS_DIR; };
960964
57A27C841C178F17000DF951 /* Kinvey.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Kinvey.h; sourceTree = "<group>"; };
961965
57A27C861C178F17000DF951 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -1425,6 +1429,7 @@
14251429
5759854F1CC834FE0054DF08 /* MedData.swift */,
14261430
57375F8F1E3FD71D0015A241 /* UploadAndPlayVideoViewController.swift */,
14271431
57ABEBE71F32819B00B47708 /* LargeDataScrollViewController.swift */,
1432+
57465B3A1F956E5E007F86C7 /* PullDataStoreViewController.swift */,
14281433
);
14291434
path = KinveyApp;
14301435
sourceTree = "<group>";
@@ -1578,6 +1583,7 @@
15781583
57E1C3A21C17B3FF00578974 /* Query.swift */,
15791584
57E1C3A61C17B4F300578974 /* Persistable.swift */,
15801585
57B768801D10C0C70086AA38 /* Entity.swift */,
1586+
57A1E7412008877E00B19CFB /* Options.swift */,
15811587
57E1C3AE1C18153900578974 /* RequestFactory.swift */,
15821588
57E1C3B01C18156700578974 /* HttpRequestFactory.swift */,
15831589
57E1C3B21C1822B100578974 /* ResponseParser.swift */,
@@ -3003,6 +3009,7 @@
30033009
files = (
30043010
57ADC0C41CC95CF4002B517A /* PerformanceTestData.swift in Sources */,
30053011
575985501CC834FE0054DF08 /* MedData.swift in Sources */,
3012+
57465B3B1F956E5E007F86C7 /* PullDataStoreViewController.swift in Sources */,
30063013
57ABEBE91F3282AC00B47708 /* HierarchyCache.swift in Sources */,
30073014
57A960A61CC827A3005E52A8 /* PerformanceTestMedData.swift in Sources */,
30083015
5759854E1CC833930054DF08 /* LongData.swift in Sources */,
@@ -3152,6 +3159,7 @@
31523159
57A2ED8E1C49D20B006D26A9 /* HttpRequest.swift in Sources */,
31533160
57C2F1731D5E5A68005A214B /* BuilderType.swift in Sources */,
31543161
57BB56B61C4D8E8400F6B548 /* LocalResponse.swift in Sources */,
3162+
57A1E7422008877E00B19CFB /* Options.swift in Sources */,
31553163
57B0E9501C5FF52200BA984F /* Push.swift in Sources */,
31563164
57E6BD441EC648F9000E5C52 /* PubNubRealtimeRouter.swift in Sources */,
31573165
574912711C59323B00EA4F26 /* StoreType.swift in Sources */,

Kinvey/Kinvey/Client.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,11 @@ open class Client: Credential {
249249
syncManager = SyncManager(persistenceId: appKey, encryptionKey: encryptionKey as Data?, schemaVersion: schemaVersion)
250250

251251
var apiHostName = apiHostName
252-
if let apiHostNameString = apiHostName.absoluteString as String?, apiHostNameString.characters.last == "/" {
252+
if let apiHostNameString = apiHostName.absoluteString as String?, apiHostNameString.last == "/" {
253253
apiHostName = URL(string: String(apiHostNameString.dropLast()))!
254254
}
255255
var authHostName = authHostName
256-
if let authHostNameString = authHostName.absoluteString as String?, authHostNameString.characters.last == "/" {
256+
if let authHostNameString = authHostName.absoluteString as String?, authHostNameString.last == "/" {
257257
authHostName = URL(string: String(authHostNameString.dropLast()))!
258258
}
259259
self.apiHostName = apiHostName

Kinvey/Kinvey/DataStore.swift

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,11 +1779,13 @@ open class DataStore<T: Persistable> where T: NSObject {
17791779
) -> Request {
17801780
return pull(
17811781
query,
1782-
deltaSet: deltaSet
1783-
) { (result: Result<[T], Swift.Error>) in
1782+
options: Options(
1783+
deltaSet: deltaSet
1784+
)
1785+
) { (result: Result<AnyRandomAccessCollection<T>, Swift.Error>) in
17841786
switch result {
1785-
case .success(let array):
1786-
completionHandler?(array, nil)
1787+
case .success(let entities):
1788+
completionHandler?(Array(entities), nil)
17871789
case .failure(let error):
17881790
completionHandler?(nil, error)
17891791
}
@@ -1801,13 +1803,13 @@ open class DataStore<T: Persistable> where T: NSObject {
18011803
) -> Request {
18021804
return pull(
18031805
query,
1804-
deltaSetCompletionHandler: {
1805-
guard let deltaSetCompletionHandler = deltaSetCompletionHandler else {
1806-
return
1807-
}
1808-
1809-
deltaSetCompletionHandler(Array($0))
1810-
},
1806+
deltaSetCompletionHandler: {
1807+
guard let deltaSetCompletionHandler = deltaSetCompletionHandler else {
1808+
return
1809+
}
1810+
1811+
deltaSetCompletionHandler(Array($0))
1812+
},
18111813
options: Options(
18121814
deltaSet: deltaSet
18131815
)
@@ -1906,9 +1908,19 @@ open class DataStore<T: Persistable> where T: NSObject {
19061908
query,
19071909
options: Options(
19081910
deltaSet: deltaSet
1909-
),
1910-
completionHandler: completionHandler
1911-
)
1911+
)
1912+
) { (result: Result<(UInt, AnyRandomAccessCollection<T>), [Swift.Error]>) in
1913+
guard let completionHandler = completionHandler else {
1914+
return
1915+
}
1916+
1917+
switch result {
1918+
case .success(let count, let results):
1919+
completionHandler(.success((count, Array(results))))
1920+
case .failure(let error):
1921+
completionHandler(.failure(error))
1922+
}
1923+
}
19121924
}
19131925

19141926
/// Calls `push` and then `pull` methods, so it sends all the pending records in the local cache and then gets the records from the backend and saves locally in the local cache.

Kinvey/Kinvey/Entity.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ public typealias Object = RealmSwift.Object
2929
internal func StringFromClass(cls: AnyClass) -> String {
3030
var className = NSStringFromClass(cls)
3131
let regex = try! NSRegularExpression(pattern: "(?:RLM.+_(.+))|(?:RLM:\\S* (.*))") // regex to catch Realm classnames like `RLMStandalone_`, `RLMUnmanaged_`, `RLMAccessor_` or `RLM:Unmanaged `
32-
var nMatches = regex.numberOfMatches(in: className, range: NSRange(location: 0, length: className.characters.count))
32+
var nMatches = regex.numberOfMatches(in: className, range: NSRange(location: 0, length: className.count))
3333
while nMatches > 0 {
3434
let classObj: AnyClass! = NSClassFromString(className)!
3535
let superClass: AnyClass! = class_getSuperclass(classObj)
3636
className = NSStringFromClass(superClass)
37-
nMatches = regex.numberOfMatches(in: className, range: NSRange(location: 0, length: className.characters.count))
37+
nMatches = regex.numberOfMatches(in: className, range: NSRange(location: 0, length: className.count))
3838
}
3939
return className
4040
}

Kinvey/Kinvey/Error.swift

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,21 @@ import Foundation
1111
/// Enum that contains all error types in the library.
1212
public enum Error: Swift.Error, LocalizedError, CustomStringConvertible, CustomDebugStringConvertible {
1313

14-
/// Constant for 401 responses where the credentials are not enough to complete the request.
15-
public static let InsufficientCredentials = "InsufficientCredentials"
16-
17-
/// Constant for 401 responses where the credentials are not valid to complete the request.
18-
public static let InvalidCredentials = "InvalidCredentials"
19-
20-
/// Constant for 400 response where the number of results exceeded the limit.
21-
public static let ResultSetSizeExceeded = "ResultSetSizeExceeded"
14+
public enum Keys: String {
15+
16+
/// Constant for 401 responses where the credentials are not enough to complete the request.
17+
case insufficientCredentials = "InsufficientCredentials"
18+
19+
/// Constant for 401 responses where the credentials are not valid to complete the request.
20+
case invalidCredentials = "InvalidCredentials"
21+
22+
/// Constant for 400 response where the number of results exceeded the limit.
23+
case resultSetSizeExceeded = "ResultSetSizeExceeded"
24+
25+
/// Constant for 404 response where the entity was not found in the collection
26+
case entityNotFound = "EntityNotFound"
27+
28+
}
2229

2330
/// Error where Object ID is required.
2431
case objectIdMissing
@@ -74,6 +81,8 @@ public enum Error: Swift.Error, LocalizedError, CustomStringConvertible, CustomD
7481
/// Error when the number of results exceeded the limit
7582
case resultSetSizeExceeded(debug: String, description: String)
7683

84+
case entityNotFound(debug: String, description: String)
85+
7786
/// Error localized description.
7887
public var description: String {
7988
let bundle = Bundle(for: Client.self)
@@ -86,7 +95,8 @@ public enum Error: Swift.Error, LocalizedError, CustomStringConvertible, CustomD
8695
.missingConfiguration(_, _, _, let description),
8796
.appNotFound(let description),
8897
.forbidden(let description),
89-
.resultSetSizeExceeded(_, let description):
98+
.resultSetSizeExceeded(_, let description),
99+
.entityNotFound(_, let description):
90100
return description
91101
case .objectIdMissing:
92102
return NSLocalizedString("Error.objectIdMissing", bundle: bundle, comment: "")
@@ -123,7 +133,8 @@ public enum Error: Swift.Error, LocalizedError, CustomStringConvertible, CustomD
123133
.dataLinkEntityNotFound(_, _, let debug, _),
124134
.missingConfiguration(_, _, let debug, _),
125135
.unauthorized(_, _, _, let debug, _),
126-
.resultSetSizeExceeded(let debug, _):
136+
.resultSetSizeExceeded(let debug, _),
137+
.entityNotFound(let debug, _):
127138
return debug
128139
default:
129140
return description

0 commit comments

Comments
 (0)