Learning SwiftUI is tough because it is still early days
Back in early October I quipped that I was opening Xcode to start a new project. I have no qualms in telling you that the project was going to be a Mac app for Unmark. I was going to build the app for a variety of reasons but the main one was to learn SwiftUI.
My experiences learning Swift, the language, were rather positive back in 2017 when I built two apps. I re-read that post this morning and some of it still holds true.
With SwiftUI, though, I found myself postponing the project for a bit because I simply could not get SwiftUI-based views to work the way I expected them to work. Particularly around using CoreData with SwiftUI. I believe it was because, as Marco Arment said at the opening of the latest episode of Under The Radar (thanks to Casey Liss for the transcript):
Having to learn SwiftUI is, first of all, the learning resources out there are still terrible, because it’s such a young language/framework/method of even thinking about things. It’s so young, and it changes so frequently — similar to the early days of Swift — that a lot of the tutorials, sample code, or Stack Overflow answers that are out there are no longer even correct. Because something has changed since when they were written last year, and now. Or the answer was posted during a beta, and in a later beta even that same year, the name of a class changed, or the way you’re supposed to do something changed. It’s so early, still.
It is so early that almost every bit of code or tutorials that I found to fix an issue I ran across contradicted any other code or tutorial that I found. It is typical in programming to find some conflicting ways of doing something – but very, very basic things usually gel.
It would be like finding two Hello World code samples where each have totally different ways of printing Hello World to the screen and you try them and neither of them work.
I don’t doubt that if I persevered I could have made much more progress than I had. In the short time that I played with SwiftUI for this project, I definitely saw the merits in it. It seems as though it is going to be very quick to build rather complex views that can be previewed as you work. Very cool stuff.
After digging and digging I found that the version of macOS and Xcode that I currently have installed doesn’t support a few things I was trying to do. Mostly because the versions I need are in beta, I’m not going to update to them for some time.
So the Unmark for Mac app is on the shelf until then. Perhaps when I pick it back up the documentation surrounding SwiftUI will have matured as well.