Skip to content

Commit 89e5e69

Browse files
authored
feat: add migration from Obj-C SDK to Swift SDK (#391)
* fix changelog * feat: add migration from Obj-C SDK to Swift SDK * don't build new methods on linux, windows, android * nits * consolidate objc keychain calls * add migrate and delete methods for ParseInstallation * don't build async for linux * change default installation behavior * add loginUsingObjCKeychain tests * lint * add combine tests * make installation methods static * add tests * nits
1 parent 675168e commit 89e5e69

File tree

89 files changed

+2695
-380
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+2695
-380
lines changed

.codecov.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ coverage:
66
status:
77
patch:
88
default:
9-
target: 33
9+
target: 75
1010
changes: false
1111
project:
1212
default:

CHANGELOG.md

+25-15
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
# Parse-Swift Changelog
22

33
### main
4+
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/4.9.0...main)
5+
* _Contributing to this repo? Add info about your change here to be included in the next release_
6+
7+
### 4.9.0
8+
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/4.8.0...4.9.0)
49

510
__New features__
11+
- Add methods for migrating users and installations from the Parse Objective-C SDK to the Swift SDK ([#391](https://github.com/parse-community/Parse-Swift/pull/391)), thanks to [Corey Baker](https://github.com/cbaker6).
612
- Enable query caching by using GET instead of POST. GET is now used by default. To switch back to POST, set usingPostForQuery = true when initializing the SDK which will automatically disable all query caching ([#386](https://github.com/parse-community/Parse-Swift/pull/386)), thanks to [Corey Baker](https://github.com/cbaker6).
713

814
__Improvements__
15+
- Add more details to error messages related when decoding errors occur ([#388](https://github.com/parse-community/Parse-Swift/pull/388)), thanks to [Daniel Blyth](https://github.com/dblythy).
916
- Added discardableResult to allow developers to choose whether or not certain functions should return a result ([#385](https://github.com/parse-community/Parse-Swift/pull/385)), thanks to [Damian Van de Kauter](https://github.com/vdkdamian).
1017

11-
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/4.8.0...main)
12-
* _Contributing to this repo? Add info about your change here to be included in the next release_
18+
__Fixes__
19+
- Ensure properties that are already saved ParseObject's are converted to Parse pointers when using saveAll ([#390](https://github.com/parse-community/Parse-Swift/pull/390)), thanks to [Corey Baker](https://github.com/cbaker6).
20+
21+
### 4.8.0
22+
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/4.7.0...4.8.0)
1323

1424
__New features__
1525
- Add ParseSpotify authentication ([#375](https://github.com/parse-community/Parse-Swift/pull/375)), thanks to [Ulaş Sancak](https://github.com/rocxteady).
@@ -168,7 +178,7 @@ __Fixes__
168178
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/2.3.0...2.3.1)
169179

170180
__Fixes__
171-
- Fixed an issue where querying an object didn't dispatch to the proper queue which can cause app crashes ([#293](https://github.com/parse-community/Parse-Swift/pull/293)), thanks to [Corey Baker](https://github.com/cbaker6).
181+
- Fixed an issue where querying an object did not dispatch to the proper queue which can cause app crashes ([#293](https://github.com/parse-community/Parse-Swift/pull/293)), thanks to [Corey Baker](https://github.com/cbaker6).
172182

173183
### 2.3.0
174184
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/2.2.6...2.3.0)
@@ -178,7 +188,7 @@ __New features__
178188
- Add toCLLocation and toCLLocationCoordinate2D methods for easy conversion from a ParseGeoPoint object ([#287](https://github.com/parse-community/Parse-Swift/pull/287)), thanks to [Jayson Ng](https://github.com/jaysonng).
179189

180190
__Fixes__
181-
- Fixed an issue where an annonymous couldn't be turned into a regular user using signup ([#291](https://github.com/parse-community/Parse-Swift/pull/291)), thanks to [Corey Baker](https://github.com/cbaker6).
191+
- Fixed an issue where an annonymous could not be turned into a regular user using signup ([#291](https://github.com/parse-community/Parse-Swift/pull/291)), thanks to [Corey Baker](https://github.com/cbaker6).
182192
- The default ACL is now deleted from the keychain when a user is logged out. This previously caused an issue when logging out a user and logging in as a different user caused all objects to only have ACL permisions for the logged in user ([#291](https://github.com/parse-community/Parse-Swift/pull/291)), thanks to [Corey Baker](https://github.com/cbaker6).
183193

184194
### 2.2.6
@@ -225,7 +235,7 @@ __Improvements__
225235
- Added ability to fetch ParsePointer using async/await ([#271](https://github.com/parse-community/Parse-Swift/pull/271)), thanks to [Corey Baker](https://github.com/cbaker6).
226236

227237
__Fixes__
228-
- By default, don't use cache when fetching ParseObject's and ParseFile's. Developers can choose to fetch from cache if desired by passing the necessary option while fetching. Fixed a bug when the incorrect file location for a dowloaded ParseFile was being cached ([#272](https://github.com/parse-community/Parse-Swift/pull/272)), thanks to [Corey Baker](https://github.com/cbaker6).
238+
- By default, do not use cache when fetching ParseObject's and ParseFile's. Developers can choose to fetch from cache if desired by passing the necessary option while fetching. Fixed a bug when the incorrect file location for a dowloaded ParseFile was being cached ([#272](https://github.com/parse-community/Parse-Swift/pull/272)), thanks to [Corey Baker](https://github.com/cbaker6).
229239

230240
### 2.1.0
231241
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/2.0.3...2.1.0)
@@ -306,13 +316,13 @@ __Improvements__
306316
- (Breaking Change) Provide ParseObject property, emptyObject, that makes it easy to send only modified keys to the server. This change "might" be breaking depending on your implementation as it requires ParseObjects to now have an empty initializer, init() ([#243](https://github.com/parse-community/Parse-Swift/pull/243)), thanks to [Corey Baker](https://github.com/cbaker6).
307317

308318
__Fixes__
309-
- ParseUser shouldn't send email if it hasn't been modified or else email verification is resent ([#241](https://github.com/parse-community/Parse-Swift/pull/241)), thanks to [Corey Baker](https://github.com/cbaker6).
319+
- ParseUser should not send email if it has not been modified or else email verification is resent ([#241](https://github.com/parse-community/Parse-Swift/pull/241)), thanks to [Corey Baker](https://github.com/cbaker6).
310320

311321
### 1.9.10
312322
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.9.9...1.9.10)
313323

314324
__Fixes__
315-
- ParseInstallation can't be retreived from Keychain after the first fun ([#236](https://github.com/parse-community/Parse-Swift/pull/236)), thanks to [Corey Baker](https://github.com/cbaker6).
325+
- ParseInstallation cannot be retreived from Keychain after the first fun ([#236](https://github.com/parse-community/Parse-Swift/pull/236)), thanks to [Corey Baker](https://github.com/cbaker6).
316326

317327
### 1.9.9
318328
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.9.8...1.9.9)
@@ -386,13 +396,13 @@ __New features__
386396
__Improvements__
387397
- Removed CommonCrypto and now uses encoded string as a hash for child ParseObjects across all OS's ([#184](https://github.com/parse-community/Parse-Swift/pull/184)), thanks to [Corey Baker](https://github.com/cbaker6).
388398
- All types now conform to CustomStringConvertible ([#185](https://github.com/parse-community/Parse-Swift/pull/185)), thanks to [Corey Baker](https://github.com/cbaker6).
389-
- Setting limit = 0 of a query doesn't query the server and instead just returns empty or no results depending on the query ([#189](https://github.com/parse-community/Parse-Swift/pull/189)), thanks to [Corey Baker](https://github.com/cbaker6).
399+
- Setting limit = 0 of a query does not query the server and instead just returns empty or no results depending on the query ([#189](https://github.com/parse-community/Parse-Swift/pull/189)), thanks to [Corey Baker](https://github.com/cbaker6).
390400
- ParseGeoPoint initializer now throws if geopoints are out-of-bounds instead of asserting ([#190](https://github.com/parse-community/Parse-Swift/pull/190)), thanks to [Corey Baker](https://github.com/cbaker6).
391-
- Persist all properties of ParseUser and ParseInstallation to keychain so they can be accessed via current. Developers don't have to fetch the ParseUser or ParseInstlation after app restart anymore ([#191](https://github.com/parse-community/Parse-Swift/pull/191)), thanks to [Corey Baker](https://github.com/cbaker6).
401+
- Persist all properties of ParseUser and ParseInstallation to keychain so they can be accessed via current. Developers do not have to fetch the ParseUser or ParseInstlation after app restart anymore ([#191](https://github.com/parse-community/Parse-Swift/pull/191)), thanks to [Corey Baker](https://github.com/cbaker6).
392402

393403
__Fixes__
394404
- Fixed a bug when signing up from a ParseUser instance resulted in custom keys not being persisted to the keychain ([#187](https://github.com/parse-community/Parse-Swift/pull/187)), thanks to [Corey Baker](https://github.com/cbaker6).
395-
- Fixed a bug where countExplain query result wasn't returned as an array ([#189](https://github.com/parse-community/Parse-Swift/pull/189)), thanks to [Corey Baker](https://github.com/cbaker6).
405+
- Fixed a bug where countExplain query result was not returned as an array ([#189](https://github.com/parse-community/Parse-Swift/pull/189)), thanks to [Corey Baker](https://github.com/cbaker6).
396406
- The query withinPolygon(key: String, points: [ParseGeoPoint]) now works correctly and sends an array of doubles instead of an array of GeoPoint's ([#190](https://github.com/parse-community/Parse-Swift/pull/190)), thanks to [Corey Baker](https://github.com/cbaker6).
397407
- Fixed a bug where the ParseEncoder incorrectly detects a circular dependency when two child objects are the same ([#194](https://github.com/parse-community/Parse-Swift/pull/194)), thanks to [Corey Baker](https://github.com/cbaker6).
398408
- Make sure all LiveQuery socket changes are received on the correct queue to prevent threading issues ([#195](https://github.com/parse-community/Parse-Swift/pull/195)), thanks to [Corey Baker](https://github.com/cbaker6).
@@ -440,7 +450,7 @@ __Improvements__
440450
- Append instead of replace when using query select, exclude, include, and fields ([#155](https://github.com/parse-community/Parse-Swift/pull/155)), thanks to [Corey Baker](https://github.com/cbaker6).
441451

442452
__Fixes__
443-
- Transactions currently don't work when using MongoDB(postgres does work) on the parse-server. Internal use of transactions are disabled by default. If you want the Swift SDK to use transactions internally, you need to set isUsingTransactionsInternally=true when configuring the client. It is recommended not to use transactions if you are using MongoDB until it's fixed on the server ([#158](https://github.com/parse-community/Parse-Swift/pull/158)), thanks to [Corey Baker](https://github.com/cbaker6).
453+
- Transactions currently do not work when using MongoDB(postgres does work) on the parse-server. Internal use of transactions are disabled by default. If you want the Swift SDK to use transactions internally, you need to set isUsingTransactionsInternally=true when configuring the client. It is recommended not to use transactions if you are using MongoDB until it is fixed on the server ([#158](https://github.com/parse-community/Parse-Swift/pull/158)), thanks to [Corey Baker](https://github.com/cbaker6).
444454

445455
### 1.8.0
446456
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.7.2...1.8.0)
@@ -462,7 +472,7 @@ __New features__
462472
- Added ability to send context with object by specifying it within options ([#140](https://github.com/parse-community/Parse-Swift/pull/140)), thanks to [Corey Baker](https://github.com/cbaker6).
463473

464474
__Fixes__
465-
- ParseFiles can't be updated from the client and will now throw an error if attempted. Instead another file should be created and the older file should be deleted by the developer. ([#144](https://github.com/parse-community/Parse-Swift/pull/144)), thanks to [Corey Baker](https://github.com/cbaker6).
475+
- ParseFiles cannot be updated from the client and will now throw an error if attempted. Instead another file should be created and the older file should be deleted by the developer. ([#144](https://github.com/parse-community/Parse-Swift/pull/144)), thanks to [Corey Baker](https://github.com/cbaker6).
466476
- Fixed issue where Swift SDK prevented fetching of Parse objects when custom objectId was enabled ([#139](https://github.com/parse-community/Parse-Swift/pull/139)), thanks to [Corey Baker](https://github.com/cbaker6).
467477

468478
__Improvements__
@@ -497,7 +507,7 @@ __Improvements__
497507
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.4.0...1.5.0)
498508

499509
__Improvements__
500-
- (Breaking Change) Aggregrate takes any Encodable type. Query planning methods are now: findExlpain, firstEplain, countExplain, etc. The distinct query now works. The client will also not throw an error anymore when attempting to delete a File and the masterKey isn't available. The developer will still need to configure the server to delete the file properly ([#122](https://github.com/parse-community/Parse-Swift/pull/122)), thanks to [Corey Baker](https://github.com/cbaker6).
510+
- (Breaking Change) Aggregrate takes any Encodable type. Query planning methods are now: findExlpain, firstEplain, countExplain, etc. The distinct query now works. The client will also not throw an error anymore when attempting to delete a File and the masterKey is not available. The developer will still need to configure the server to delete the file properly ([#122](https://github.com/parse-community/Parse-Swift/pull/122)), thanks to [Corey Baker](https://github.com/cbaker6).
501511

502512
### 1.4.0
503513
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.3.1...1.4.0)
@@ -559,7 +569,7 @@ __New features__
559569
- Add build support for Android ([#90](https://github.com/parse-community/Parse-Swift/pull/90)), thanks to [jt9897253](https://github.com/jt9897253).
560570

561571
__Fixes__
562-
- There was another bug after a user first logs in anonymously and then becomes a real user. The authData sent to the server wasn't stripped, keep the user anonymous instead of making them a real user ([#100](https://github.com/parse-community/Parse-Swift/pull/100)), thanks to [Corey Baker](https://github.com/cbaker6).
572+
- There was another bug after a user first logs in anonymously and then becomes a real user. The authData sent to the server was not stripped, keep the user anonymous instead of making them a real user ([#100](https://github.com/parse-community/Parse-Swift/pull/100)), thanks to [Corey Baker](https://github.com/cbaker6).
563573

564574
### 1.2.1
565575
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.2.0...1.2.1)
@@ -679,7 +689,7 @@ __Improvements__
679689

680690
__Fixes__
681691
- Delete current installation during logout ([#52](https://github.com/parse-community/Parse-Swift/pull/52)), thanks to [Corey Baker](https://github.com/cbaker6).
682-
- Parse server supports `$eq`, but this isn't supported by LiveQueryServer, switched to supported ([#49](https://github.com/parse-community/Parse-Swift/pull/49)), thanks to [Corey Baker](https://github.com/cbaker6).
692+
- Parse server supports `$eq`, but this is not supported by LiveQueryServer, switched to supported ([#49](https://github.com/parse-community/Parse-Swift/pull/49)), thanks to [Corey Baker](https://github.com/cbaker6).
683693
- Bug when updating a ParseObject bug where objects was accidently converted to pointers ([#48](https://github.com/parse-community/Parse-Swift/pull/48)), thanks to [Corey Baker](https://github.com/cbaker6).
684694
- User logout was calling the wrong endpoint ([#43](https://github.com/parse-community/Parse-Swift/pull/43)), thanks to [Corey Baker](https://github.com/cbaker6) and [Tom Fox](https://github.com/TomWFox).
685695
- Fix an issue where ACL was overwritten with nil ([#40](https://github.com/parse-community/Parse-Swift/pull/40)), thanks to [Corey Baker](https://github.com/cbaker6).

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Together we will plan out the best conceptual approach for your contribution, so
2727

2828
When you are ready to code, you can find more information about opening a pull request in the [GitHub docs](https://help.github.com/articles/creating-a-pull-request/).
2929

30-
Whether this is your first contribution or you are already an experienced contributor, the Parse Community has your back – don't hesitate to ask for help!
30+
Whether this is your first contribution or you are already an experienced contributor, the Parse Community has your back – do not hesitate to ask for help!
3131

3232
## Why Contributing?
3333

ParseSwift.playground/Pages/1 - Your first Object.xcplaygroundpage/Contents.swift

+9-9
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ score.save { result in
121121
assert(savedScore.points == 10)
122122

123123
/*: To modify, need to make it a var as the value type
124-
was initialized as immutable. Using `mutable`
124+
was initialized as immutable. Using `mergeable`
125125
allows you to only send the updated keys to the
126126
parse server as opposed to the whole object.
127127
*/
@@ -195,7 +195,7 @@ var score2ForFetchedLater: GameScore?
195195
}
196196
}*/
197197

198-
//: Save synchronously (not preferred - all operations on main queue).
198+
//: Save synchronously (not preferred - all operations on current queue).
199199
let savedScore: GameScore?
200200
do {
201201
savedScore = try score.save()
@@ -211,7 +211,7 @@ assert(savedScore?.updatedAt != nil)
211211
assert(savedScore?.points == 10)
212212

213213
/*: To modify, need to make it a var as the value type
214-
was initialized as immutable. Using `mutable`
214+
was initialized as immutable. Using `mergeable`
215215
allows you to only send the updated keys to the
216216
parse server as opposed to the whole object.
217217
*/
@@ -274,7 +274,7 @@ do {
274274
//: Now we will fetch a ParseObject that has already been saved based on its' objectId.
275275
let scoreToFetch = GameScore(objectId: savedScore?.objectId)
276276

277-
//: Asynchronously (preferred way) fetch this GameScore based on it's objectId alone.
277+
//: Asynchronously (preferred way) fetch this GameScore based on it is objectId alone.
278278
scoreToFetch.fetch { result in
279279
switch result {
280280
case .success(let fetchedScore):
@@ -284,7 +284,7 @@ scoreToFetch.fetch { result in
284284
}
285285
}
286286

287-
//: Synchronously fetch this GameScore based on it's objectId alone.
287+
//: Synchronously fetch this GameScore based on it is objectId alone.
288288
do {
289289
let fetchedScore = try scoreToFetch.fetch()
290290
print("Successfully fetched: \(fetchedScore)")
@@ -295,7 +295,7 @@ do {
295295
//: Now we will fetch `ParseObject`'s in batch that have already been saved based on its' objectId.
296296
let score2ToFetch = GameScore(objectId: score2ForFetchedLater?.objectId)
297297

298-
//: Asynchronously (preferred way) fetch GameScores based on it's objectId alone.
298+
//: Asynchronously (preferred way) fetch GameScores based on it is objectId alone.
299299
[scoreToFetch, score2ToFetch].fetchAll { result in
300300
switch result {
301301
case .success(let fetchedScores):
@@ -315,7 +315,7 @@ let score2ToFetch = GameScore(objectId: score2ForFetchedLater?.objectId)
315315

316316
var fetchedScore: GameScore!
317317

318-
//: Synchronously fetchAll GameScore's based on it's objectId's alone.
318+
//: Synchronously fetchAll GameScore's based on it is objectId's alone.
319319
do {
320320
let fetchedScores = try [scoreToFetch, score2ToFetch].fetchAll()
321321
fetchedScores.forEach { result in
@@ -331,7 +331,7 @@ do {
331331
assertionFailure("Error fetching: \(error)")
332332
}
333333

334-
//: Asynchronously (preferred way) deleteAll GameScores based on it's objectId alone.
334+
//: Asynchronously (preferred way) deleteAll GameScores based on it is objectId alone.
335335
[scoreToFetch, score2ToFetch].deleteAll { result in
336336
switch result {
337337
case .success(let deletedScores):
@@ -348,7 +348,7 @@ do {
348348
}
349349
}
350350

351-
//: Synchronously deleteAll GameScore's based on it's objectId's alone.
351+
//: Synchronously deleteAll GameScore's based on it is objectId's alone.
352352
//: Commented out because the async above deletes the items already.
353353
/* do {
354354
let fetchedScores = try [scoreToFetch, score2ToFetch].deleteAll()

ParseSwift.playground/Pages/12 - Roles and Relations.xcplaygroundpage/Contents.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ var savedRole: Role<User>?
109109

110110
//: Now we will create the Role.
111111
guard let currentUser = User.current else {
112-
fatalError("User currently isn't signed in")
112+
fatalError("User currently is not signed in")
113113
}
114114

115-
//: Every Role requires an ACL that can't be changed after saving.
115+
//: Every Role requires an ACL that cannot be changed after saving.
116116
var acl = ParseACL()
117117
acl.setReadAccess(user: currentUser, value: true)
118118
acl.setWriteAccess(user: currentUser, value: true)
@@ -312,7 +312,7 @@ let score2 = GameScore(points: 57)
312312
print(error)
313313
}
314314
case .failure(let error):
315-
print("Couldn't save scores. \(error)")
315+
print("Could not save scores. \(error)")
316316
}
317317
}
318318

0 commit comments

Comments
 (0)