Archive for November 7, 2018

Wednesday, November 7, 2018 [Tweets] [Favorites]

Server-side Swift: Making Canopy

Max Howell:

Swift is not the best language at everything, but it is the best set of trade-offs that make it the best language overall for anything (it supports) right now. Since it was announced the clear and careful design decisions of Swift-Core have impressed me enough to commit to it entirely. I have programmed in many, many languages and often find that the language and its standard library are inconsistently good, Team-Swift give a damn about their language and its standard library at a level beyond anything else out there.

[…]

Intrinsic type-safety cross-process with barely any work from me was super comfy and made the 1,000 miles between me and my server seem no different to passing data between view-controllers.

However the lack of dynamism means even adding a single parameter to these structs means versioning my endpoints or making new parameters Optional. It’s not all roses, but frankly, versioning has worked well and means my code for interpreting incoming data is not a logic bomb of if-statements, it is carefully, separately encapsulated and tested, type-safe endpoints.

Previously: When JSONDecoder Meets the Real World, Swift.Codable, Swift 4: JSON With Encoder and Encodable.

Losing Health Data When Upgrading a iPhone

Ryan Jones:

Mom lost all 4 yrs of health data moving to new iPhone. Apple support says it’s not in the cloud.

Thus continues the years of confusing unclear health data management.

Health data truth, as on Nov 2018.

✅ iCloud Sync, if toggled on
❌ iCloud Backup, never ever
❌ Unecrypted iTunes Backup, never ever
✅ Encrypted iTunes Backup, only if iCloud Sync is off

So, if you get a new phone and it magically disappears from iCloud...

Ryan Jones:

Without explaining the hoops and exceptions, here’s what to do:

Apple syncs health data, aka sends it between devices. When one device has it, you’re good. When switching to new iPhones this often isn’t true.

To be safe: Open Health, tap your head, tap export; monthly.

The Health app can’t import its own data, so you need to use (and trust) a third-party app. Also, chances are you’re going to use iCloud (or some even less secure means) to transport the export file, so why not just include it (optionally) in the iCloud backup. This is a pattern we see from time to time with Apple. You run into the limits of Apple’s idealized solution and then it’s sort of your fault if something goes wrong with the more pragmatic solution that you resort to. But it’s also sort of Apple’s fault for only solving part of the problem that it was in the better position to address.

Ryan Jones:

You MUST keep old phone online on iCloud. ICloud itself knows nothing about health, it just transports it from devices.

There’s no reason this kind of system should be any more reliable than iMessage delivery, which I’m still having trouble with. But the consequences are potentially much greater: losing a potentially large amount of important data.

Update (2018-11-08): This seems like such a weird design. Few people seem to know that this is how the data is supposed to be transferred. Even if you know how it’s supposed to work, how can you tell when it’s done, and it’s safe to get rid of the old phone?

Thomas Brand:

This happened to me last month when I upgraded from my iPhone SE. I lost all of my Health data backed up to iCloud. My only recourse was restoring from my last iTunes backup taken in June. I was forced to choose between restoring 2 years of running data or my last iCloud backup.

Ryan Jones:

Again this is the crux with Health data. It syncs via iCloud. That means it uses iCloud to send changes back and forth, but it’s not backed up or snapshotted anywhere. So IF it gets out of sync, over writes data, things an empty phone is the truth... F’ed.

[…]

Meaning health data is STORED in iCloud but it is NOT BACKED UP in iCloud.

Meaning they keep only the one “live” copy.

So you buy a new iPhone, trade in your old one, start the iCloud restore, hand Apple employee your old phone and they wipe it... boom, all gone, the end.