Now that the euphoria and dust has settled from WWDC 2019, it would be wise to take a step back and plan for the future. How far in the future you ask? I keep hearing “several years” and “we got time” since iOS13+ is where the future starts. If we were Android developers, then ya we got a looooong time 😜, but let me remind you that this time next year 90%+ of your users will be on iOS 13.
So no, iOS 13 adoption is not our problem. Our problem is there’s not a single production app in the universe running on SwiftUI yet. We have no idea how to architect this thing, or how to scale it, or what will maintenance be like with a team of developers and tens of thousands of live users. That’s what our focus should be. And that should start now.
Where Do We Start??!!?!
It’s easy to feel discouraged or overwhelmed. It’s the biggest shift in Apple development since the introduction of Swift. We just started getting comfortable with Swift, then 💥… there goes UIKit!
Take a deep breath… don’t despair, you have the S.O.L.I.D. principles. These principles have lived through the ages of languages, platforms, and frameworks. And remember, an architecture doesn’t revolve around Swift, SwiftUI, and Combine; they revolve around it! So keep that in mind and let’s proceed…
Step 1: Make a Swift Framework
If you don’t have a Swift framework, that’s where you should start. Extract all the logic from your app into a “core” framework. Trash your app a thousand times if you want, but your framework should live on. It should live on beyond app rewrites and even across projects. If you work at Acme Inc. or own a company, you’d better have an AcmeCore or AcmeKit framework. See my Swift framework that I use across all my apps and projects. I don’t always take it as a dependency, but at least I copy code and unit tests from it into other “core” frameworks. Or here’s another example with network and database components. The point is don’t ever create an app without a “core” framework. It will force you to decouple your logic from the UI and platforms. Also make sure it works with Swift Package Manager.
Step 2: Get Familiar with Combine
Reactive programming is a different mindset than traditional programming. I think the Combine framework is the most profound thing to come out of WWDC 2019. Sure SwiftUI is really cool, but Combine will exist beyond apps. The “core” framework I talked about will be laced with Combine eventually, not SwiftUI. If Swift server-side ever sees the light of day, it will use Combine. Swift daemons will use Combine. Databases will use Combine. NotificationCenter, Timers, Networking.. will-all-be-COMBINE! Stay on top of Combine like nothing else. Completion handlers and delegates will be relics of the past.
Step 3: Create an “ios13” Branch
There’s no better way to figure out how all this stuff will play out than to actually mess around with it in a production app. Look at your AppDelegate, your login screen, the network layer, database services, wherever you can to figure out how SwiftUI and Combine will work in a production app. We can create a dozen Mickey Mouse apps (and there are plenty out there), but it won’t give you the insight of how it will work in a production app. Obviously, don’t release the app to the public just yet, but this should get the gears turning in your mind when you face real-world challenges and solve them with these new tools.
See You on the Flip Side!
These are small steps to begin your path towards the promise land. Better start now instead of thinking “we got time”. WWDC 2020 is the iteration we’ll need to finally be able to use SwiftUI and Combine for production development. We’ll be saying goodbye to iOS 12 and welcoming iOS 14 before you know it (same time next year actually). Stay on top of it until then, even if nobody knows what the heck they’re doing!
Leave a Reply