You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MIGRATION.md
+2-90Lines changed: 2 additions & 90 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ This document describes how to migrate from the [Parse ObjC SDK](https://github.
12
12
13
13
# Status of the SDKs
14
14
15
-
The Parse ObjC SDK will be phased out in the future in favor of the more modern Parse Swift SDK. While both SDKs overlap in the ecosystems they serve, they are built conceptually different, which can make migration more challenging. Your milage may vary depending on your use case, we therefore encourage you to consider migrating as soon as possible.
15
+
The Parse ObjC SDK will be phased out in the future in favor of the more modern Parse Swift SDK. While both SDKs overlap in the ecosystems they serve, they are built conceptually different, which can make migration more challenging. Your milage may vary depending on your use case, we therefore encourage you to migrate as soon as possible.
16
16
17
17
# Migration Instructions
18
18
@@ -30,95 +30,7 @@ The Parse ObjC SDK will be phased out in the future in favor of the more modern
30
30
31
31
The issues below are important to consider before migrating.
32
32
33
-
- ⚠️ Partially updating an object sends the complete object (including unchanged properties) to the server if you follow the familiar syntax from the Parse ObjC SDK or any other Parse SDK. This can have a significant impact on data transfer costs depending on your use case and architecture. All other Parse SDKs, including the Parse ObjC SDK, only send the changed properties to the server. The Parse Swift SDK requires a different syntax with additional overhead to achieve the same behavior. For details see [GitHub issue #242](https://github.com/parse-community/Parse-Swift/issues/242).
34
-
35
-
<details>
36
-
<summary>Code Examples</summary>
37
-
38
-
```
39
-
// The following examples compare how to update a saved object in the Parse ObjC SDK
40
-
// vs. the Parse Swift SDK. For simplicity, the examples use synchonrous methods.
// This sends the complete object to the server when partially updating the object. This approach
51
-
// is not recommended as sending unchanged properties is unnecessary and therefore wastes resources.
52
-
struct Example: ParseObject {
53
-
var objectId: String?
54
-
var createdAt: Date?
55
-
var updatedAt: Date?
56
-
var ACL: ParseACL?
57
-
var originalData: Data?
58
-
var key: String?
59
-
}
60
-
61
-
let obj = Example()
62
-
obj.key = "value1"
63
-
obj.save()
64
-
obj.key = "value2"
65
-
obj.save()
66
-
67
-
// Parse Swift SDK - Variant 2
68
-
// This sends only the changed properties to the server. Note that `objMergable` only contains the
69
-
// modified properties and is missing the unchanged properties. To also contain the unchanged
70
-
// properties in addition to the changed properties, an additional `fetch` call on the respective
71
-
// object would be necessary. This aproach is not recommended as it adds an additional server
72
-
// request to get data that is already present locally. This is unrelated to the limitation that
73
-
// any Parse SDK is unaware of any object modification that is done via Cloud Code triggers.
74
-
struct Example: ParseObject {
75
-
var objectId: String?
76
-
var createdAt: Date?
77
-
var updatedAt: Date?
78
-
var ACL: ParseACL?
79
-
var originalData: Data?
80
-
var key: String?
81
-
}
82
-
83
-
let obj = Example()
84
-
obj.key = "value1"
85
-
obj.save()
86
-
var objMergable = obj.mergeable
87
-
objMergable.key = "value2"
88
-
objMergable.save()
89
-
90
-
// Parse Swift SDK - Variant 3
91
-
// This sends only the changed properties to the server. By overriding the `merge` method the
92
-
// `objMergable` also contains the unchanged properties of the original `obj`. This means no
93
-
// additional `fetch` call is needed. This is the recommned approach which corresponds the most
94
-
// with the behavior of the Parse ObjC SDK. Note that any change of custom properies will need
95
-
// to reflect in the `merge` method, otherwise `objMergable` may only partially contain the
96
-
// original data which leads to data inconsistencies that may be difficult to track down.
97
-
struct Example: ParseObject {
98
-
var objectId: String?
99
-
var createdAt: Date?
100
-
var updatedAt: Date?
101
-
var ACL: ParseACL?
102
-
var originalData: Data?
103
-
var key: String?
104
-
105
-
func merge(with object: Self) throws -> Self {
106
-
var updated = try mergeParse(with: object)
107
-
if updated.shouldRestoreKey(\.key, original: object) {
108
-
updated.key = object.key
109
-
}
110
-
return updated
111
-
}
112
-
}
113
-
114
-
let obj = Example()
115
-
obj.key = "value1"
116
-
obj.save()
117
-
var objMergable = obj.mergeable
118
-
objMergable.key = "value2"
119
-
objMergable.save()
120
-
```
121
-
</details>
33
+
- ⚠️ Partially updating an object sends the full object to the server; this can have a significant impact on data transfer costs depending on your use case and architecture. All other Parse SDKs including the Parse ObjC SDK only send the changed properties to the server. For details see [GitHub issue #242](https://github.com/parse-community/Parse-Swift/issues/242).
0 commit comments