How does synchronization work?

Just a curiosity.

Bear stores its data in a SQLite database, and synchronization is working really well in my tests so far. How is that synchronization implemented? How do edits in my iPhone end up in the database of my laptop? (I am a programmer, but not an Apple developer.)

Is the solution based on CloudKit perhaps? Just learning about it.

As far as I can gather digging gently around and dabbling in Swift, this is indeed the case.

Yes, not sure what else you might interested in knowing, but sync is custom-made by us and based on CloudKit while the local data is preserved with CoreData.

1 Like

@trix180 ah, CoreData! Fantastic!

What is the information that travels? For example, if I write a paragraph in the middle of an existing and shared note in my phone, do you get an “edit” operation with the whole note in desktop which you diff manually? Or just the relevant text snippet? Or is the note structure (paragraph, list item, terminal text in italics, …) abstracted and the app works at that level?

I feel I have been asked for the secret sauce recipe here :smiley:
Joking apart, right now, the whole note text moves.

2 Likes

Haha, awesome!

With the pointers to those two Apple frameworks and this, I think I can get a high-level idea of how it works.

Appreciate it @trix180!