How does Apple Notes app merge text?

I noticed that Apple's offical app Notes does automatic merge of conflict editings.


For example, if I edit a note on my iPad while offline by addng a line of text while I saved a new version on my iPhone by adding another line of text. When iPad comes online, Notes automatically merges the two lines into a 'combined' new note.


But how does that work? I assume Apple is doing somekind of magic on UITextView's attributedString. Any clues or ideas?

Changes are first in first out. Notes makes some choices which are to be kind, very

bad in most cases. I use notes to store real world access codes I need regularly

and cannot remember since I don't need them more than once every few months.

Unfortunately, notes is very bad at storing this kind of data. It needs a prompting

mechanism to allow the user to decide but simply makes an arbitrary choice on

it's own. This is sadly, the major flaw with any cloud based storage in my opinion.


Notes and similar apps, need a DO NOT MODIFY setting of some kind. I can't even

count the number of times I've looked at a stored note only to find that an unintended

modification has occured and lost critical data.

If this is about the OS X public/app store version, those user-centric questions may be better suited for Apple's public community support forums rather than here in the developer/IDE forums, thanks.


Otherwise, note the pre-release version you're using, thanks.

Yes, that's why I am designing another Notes like app, with more features:


1. Encryption

Altough we can trust Apple for their security of data servers, but I think adding another layer of encryption is more appealing.


2. Version conflicts

I agree with you in that it's a better way to prompting user that a conflicting version is on server and let user decide which version to take, or better to have a merged version for user to choose.

My question is not about user-centric questions. Actually I want to find the underlying mechanism or algorithm of Notes on conflicts handling, so that I can implement it in my own Notes like app.

How does Apple Notes app merge text?
 
 
Q