Should you use SwiftUI in production apps? Well...
Friday, May 21, 2021 2:53 PM
I have no doubt that SwiftUI is the future of Apple platform app UI development. I write SwiftUI code every day. If you develop production Apple platform apps, or aspire to, you should too. But is it ready for production? Silly Sounds and Spidget are SwiftUI apps developed using Xcode 12.4. I wrote them with fewer lines of code than the UIKit equivalent would have required. They are live with no crash reports as of iOS 14.5.1. So far, so good. But they are pretty simple apps (except for StoreKit- ouch!). And there were some iOS 14 issues which I was able to work around.
I am completely sold on the SwiftUI/Combine approach to managing state, and the declarative approach to UI development is just plain fun. So I’ve decided to write the next version of Remembered using SwiftUI. Remembered is a Swift/UIKit app developed using Xcode 10? 9? 8? I can’t remember, but it has been live in the App Store through several major and minor iOS updates with no crash reports.
So how’s it going so far? Have you ever heard the sound of screeching brakes/tires down the street? The one that seems to last forever, as you brace yourself for the inevitable sound of an expensive impact? Insert that here.
To be fair, this is a major revision- CoreData, CloudKit, transitioning from MVC to MVVM, support for multiple devices, etc. But I’ve come to the sad conclusion that SwiftUI isn’t stable enough to rely on. iOS 14.2 created problems that didn’t exist in iOS 14.1. Some of these were fixed in iOS 14.5, but iOS 14.5 has caused runtime crashes in builds that run without errors in iOS 14.4. Some of these issues are difficult to reproduce/debug. Importantly, they have the potential to wreak havoc with previously stable production apps.
I remain committed to SwiftUI, and am convinced that it will replace UIKit someday. It will be stable, fast and have feature parity. Apps will be smaller and easier to maintain. But today is not that day.