all micro contact rss

x2y 1.2 and iCloud Sync between macOS and iOS

When I created x2y for Mac, I had to decide, as you always do, which features would make it to version 1, and which would be pushed back until later. Very early in the process, I punted on iCloud sync of the common aspect ratios list. I had done sync for iOS devices before, but this time it would involve syncing between iOS and Mac devices. I didn’t even bother researching the process. I just figured it was non-essential and moved on.

Then, sometime after version 1 shipped, and I was deciding on what was next, I got it into my head that a simple key-value store sync between macOS and iOS wasn’t possible. (I don’t know why, but I certainly believed it for months, even though it’s totally not true.) Since the iOS version is currently using a simple key-value store sync for iCloud support, I figured sync for the Mac was now going to involve migration of current data to Core Data. It would mean an update of both the macOS and iOS versions, and it sounded like a massive headache. So I punted again for a few months.

Then a few weeks ago, I decided to have a look at just what would be involved, and I soon learned the truth, that key-value store sync between iOS and Mac is actually easy. Just make sure the container identifier is the same for both platforms, and the data will be available on both platforms.

In my case, since iOS was already using its default container, I just needed to tell macOS to use the iOS container. One value changed in the entitlements file, and I was in business.

Since x2y for Mac is quite a bit newer, there were some differences in how I was storing the list of aspect ratios. But it was trivial to convert the data and get the sync going.

It helps that I’m not doing a really robust sync here. This ratios list is the sort of thing you are likely to only change every so often. I didn’t want to risk date comparison mistakes, duplicates, etc. It’s much more of a “make a change on one device, and the entire list gets replaced everywhere else” sort of thing. Which has worked out perfectly well on iOS all these years.

At the end of the day, it’s a simple dictionary. No reason to make it more complicated than it needs to be.

![x2y prefs window](
x2y prefs window

I did have to add a Preferences window for the first time in a Mac app. That was fun. While I was doing that, I decided to implement an option for not saving your full screen status between launches. I have written in the past about full screen and Mac apps, and I continue to believe that far too many apps don’t save full screen between launches, which is quite annoying. But after talking with some folks on Twitter and elsewhere, it did seem reasonable that there may be some people who switch between their laptop screen and their connected external monitors who may not want the full screen state to be remembered. So I gave my customers a way to turn it off.

x2y version 1.2 is now available on the Mac App Store. As always, a review is appreciated if you are using the app and enjoy it.