Just out of curiosity, when would you guys use the custom objectId feature in your projects?
What would be the best use of the feature?
thanks,
Just out of curiosity, when would you guys use the custom objectId feature in your projects?
What would be the best use of the feature?
thanks,
IMO, custom objectId’s are useful in a few scenarios (I’m sure there are others):
In the above cases, you can also just keep separate fields for objectId
and uuid
(other database identifier), but some people prefer to minimize fields. If data transmission doesn’t happen offline or the Parse Server is the only place that syncs your data, I don’t think you need to use custom objectId, but that’s just my opinion…
It’s easy to do replace objectId
when a custom value in the Swift SDK. If you are interested you can look how I do it in one my of my projects.
Just take over the encoding of your ParseObjects
by declaring the method below in your object:
encodeVersionable
eventually calls encodeObjectable
. When encoding for parse use replace objectId with uuid
and vice-versa locally. I do this in 2-steps, when I decode a local CareKit object that has it’s own uuid
, I use it to replace the objectId of a ParseObject
:
So encodeObjectable
looks like:
You may need to setup code to access the Swift SDK encoders/decoders. That’s simple as well as you can just leverage that static methods of one of your ParseObject
's:
thank you for this detailed reply. It’s a lot for me to go through but I am. I didn’t think about the offline part of it which makes a lot of sense now that you mention it. I’m looking into how you set up PCK as well. Learning quite a bit from you.
thanks again.