Look, it’s not going to do either of us any good, here in ATATN #4, to reminisce about simpler times. Would it be nice to take a stroll through some of my favorite lesser-known features as a distraction from the all-consuming slog of implementing iCloud sync? Of course it would. But I’m just not going to peel myself away from finding another edge case, cursing, and resetting the iCloud dev environment for the thirty thousandth time to go sit in the park and talk about the Shuffle Scheduler. Although maybe the ice cream truck will come?
In this cruel world, built of uncontrollable things, the Shuffle Scheduler is a tool of control as much as it is celebration. It exists to give the simple, satisfying high of pulling up to your house right as the album ends. Timed just right, an album bookends an experience. It starts and it ends. You can go into the next thing unencumbered, a discrete chunk of your life done and dusted.
I use it all the time. If it’s 6:58PM and dinner’s at 7:30, you know I’m finding a 32 minute album to close out the day. If I’ve got a solid block of two and a half hours in the morning before a meeting, I’m building a queue to soundtrack it. The Shuffler Scheduler is extremely my shit. It is powered by just a couple of exactitudes. How much time do you have? How many albums do you want to listen to? Three albums in 90 minutes? Got it. 40 + 33 + 17 = 90.
As far on the opposite end of the spectrum as possible, we find NSPersistentCloudKitContainer, the class responsible for keeping the peace between iCloud and your on-device data. This is an important and admittedly difficult job, which it performs with the aloof mysticism of a spiritual guru. It’ll tell you a sync started and ended, sure. When might I expect the initial sync on a new device to complete? How do I know when it has? Is there anything I can do to speed things up? “It can be helpful to think of this process as similar to the water cycle,” it says, smiling knowingly. “Water evaporates up and rains down on a natural cadence.”
Thus have I spent the past few weeks trying to understand, predict, and change the weather. Why, on one device, is there an immediate downpour of cloud data, while on another there is a steady drizzle over hours? As it turns out, there are all sorts of reasons, which I have been exhaustively (and exhaustingly) cataloging and addressing. NSPersistentCloudKitContainer, like any good spiritual mentor, patiently waits, gazing at me gazing into the abyss. The answer, it knows, is within.
I can’t even be mad. It’s true. I’ll spend any amount of time tweaking the Shuffle Scheduler algorithm, but when it comes to the scaffolding around CoreData, the app’s underlying database, I tend to get to a “good enough” solution and get back to the fun stuff. But with iCloud sync, “good enough” ain’t enough. You’ve gotta come correct. So that’s what I’ve been up to. Atoning for tech debt and half-understood solutions. Somewhere in the process, perhaps during the multi-day process of auditing every time the app ever saves anything to the database, it dawned on me that two things were happening: 1) I wasn’t having very much fun, and 2) the app was clearly better for it.
I have a deeply instinctual sense of the app’s stability, and I’ll be damned if it doesn’t feel like Albums has been eating its vegetables. The more solid things feel, the better iCloud sync seems to go. It’s still a black box (you can’t control the weather, climate change not withstanding) but I am starting to believe that this time, what seems like light at the end of the iCloud tunnel might not be phantom spots on the edge of my vision, but honest-to-goodness light at the end of the iCloud tunnel.
Why do I say that? Well, I did go to the park to chill for a bit and work on this post. When my iPad battery was almost dead (and the ice cream truck came!), I went back inside, encumbered, in the middle of both this post and the album I was listening to. I sat down at my desk, plugged in my iPad to charge, opened Albums on my phone, and resumed the album I was listening to on my iPad right where I left off. That was pretty fucking dope.
See you in two weeks.