Post

Replies

Boosts

Views

Activity

Reply to How does the Reminders app implement manual sort order?
@fsdolphin https://www.youtube.com/watch?v=Rh05puZsh6o&t=529s is an example of how to manage manual sort order locally. (each item basically has a arrayPosition field) When adding CloudKit, I am not sure how to handle conflicts. Example: On the first device, move "Item 1" to the back: "Item 2" (sortOrder = 0), "Item 3" (sortOrder = 1), "Item 1" (sortOrder = 2) On the second device, move "Item 3" to the front: "Item 3" (sortOrder = 0), "Item 1" (sortOrder = 1), "Item 2" (sortOrder = 2) When syncing, the result should be: "Item 3", "Item 2", "Item 1" as if the move operations where done in chronological order
Sep ’23
Reply to How does the Reminders app implement manual sort order?
@fsdolphin A given reminder can be dragged and placed in a different position when using "Sort By Manual". This functionality is enabled when adding onMove inside a List. What I find tricky is how to handle the case when changes are made from multiple offline devices. For example, if I add a sortOrder field to each item, I would end up with duplicate values when adding a third item with sortOrder max(sortOrder) + 1 = 2 + 1 = 3 on the first offline device, and a different item with a sortOrder of 3 on the second offline device.
Sep ’23