@@ -161,7 +161,7 @@ public extension ParseObject {
161
161
}
162
162
163
163
var mergeable : Self {
164
- guard objectId != nil ,
164
+ guard isSaved ,
165
165
originalData == nil else {
166
166
return self
167
167
}
@@ -318,13 +318,11 @@ public extension ParseObject {
318
318
a Parse Server. You can also use this method on a new `ParseObject`'s that has not been saved to a Parse Server
319
319
as long as the `objectId` of the respective `ParseObject` is **nil**.
320
320
- attention: If you are using the `set()` method, you do not need to implement `merge()`. Using `set()`
321
- may perform slower than implemting `merge()` after saving the updated `ParseObject` to a Parse Server.
322
- This is due to extra overhead in encoding/decoding the object inorder to determine what keys have been updated.
323
- Developers should choose what option works best for their respective applications .
321
+ may perform slower than implementing `merge()` after saving the updated `ParseObject` to a Parse Server.
322
+ This is due to neccesary overhead required to determine what keys have been updated. If a developer finds decoding
323
+ updated `ParseObjects`'s to be slow, implementing `merge()` may speed up the process .
324
324
- warning: This method should always be used when making the very first update/mutation to your `ParseObject`.
325
- Any subsequent mutations can modify the `ParseObject` property directly or by making mutiple `set()` calls.
326
- - warning: If you have add properties to your `ParseObject`that are of type `Date` and need the precise time of
327
- the date, you should implement `merge()` or call `fetch()` on your object after updating.
325
+ Any subsequent mutations can modify the `ParseObject` property directly or use the `set()` method.
328
326
*/
329
327
func set< W> ( _ keyPath: WritableKeyPath < Self , W ? > , to value: W ) -> Self where W: Equatable {
330
328
var updated = self . mergeable
@@ -348,11 +346,8 @@ extension ParseObject {
348
346
original [ key] = value
349
347
}
350
348
let mergedEncoded = try JSONSerialization . data ( withJSONObject: original)
351
- var merged = try ParseCoding . jsonDecoder ( ) . decode ( Self . self,
352
- from: mergedEncoded)
353
- merged. createdAt = originalObject. createdAt
354
- merged. updatedAt = updatedAt
355
- return merged
349
+ return try ParseCoding . jsonDecoder ( ) . decode ( Self . self,
350
+ from: mergedEncoded)
356
351
}
357
352
}
358
353
0 commit comments