My Frustrations with SwiftUI
When I first heard about SwiftUI I was pretty excited. I had already been using React (a declarative UI “framework”) for a few years and thought this might be my entrance into creating my first iOS app. So I decided to try SwiftUI and slowly began working on a bucket-list dream of mine—making my own app.
After using SwiftUI on and off for a few years here are my biggest frustrations:
Needing to know/use UIKit to actually do what I want
I chose SwiftUI because I didn’t want to learn UIKit. It turns out that I really do need it to change certain backgrounds or to fix specific component issues (see below). Basically I need UIKit to do any specialized customization that SwiftUI doesn’t provide hooks into already. Or if it is achievable, it’s so complicated and “creative” that a normal developer wouldn’t be able to figure it out themselves. I can’t count the number of times this has come up. I often end up throwing in the towel and changing my app’s feature or aesthetic to accommodate SwiftUI instead of the reverse which is how I think it should be.
Random bugs in the built-in components
One of the main UX elements of my app is two side-by-side pickers, which is a common way I see pickers used in all kinds of apps. So I thought I could easily add this to my app. I did…and it was working for over a year. But after an update to iOS 15 the right-sided picker started overlapping the left picker. So when I attempted to select something with the left picker it would only control the right picker. The only way I could figure out a workaround in SwiftUI was to separate the pickers with a much larger space between them. To serve as a constant reminder of the absurdity of the bug (and since my app was just for fun and learning) I placed a light red “danger zone” rectangle in the middle of the pickers. I hope they fix the element before I launch it on the App Store. I don’t really want to learn UIKit just to fix this bug or result to blindly copying someone else’s code from stackoverflow—where would I be without you old friend?
The documentation
Maybe this is Apple’s documentation in general or maybe I just don’t know where to find the good stuff, but their docs are not very helpful. And by helpful I mean they don’t usually have examples; it’s very inconsistent. One of the things I love about the JavaScript/web dev community is the docs are fairly thorough and have lots of examples. I can usually see my use case or something similar to use as a springboard. Now I might not be the target audience of the Apple docs, or just not as book smart, but they seem very lacking in my opinion. Even when I lookup the available methods I usually can’t figure out how to use them from the provided information which is very frustrating. Maybe this comes with time.
Overall my experience is pretty discouraging because it seems like every time I need to do something I have to find someone else’s example code. Now to be fair I only spend a few hours a week with SwiftUI, and I think a lot of my frustrations would be alleviated if I just learned UIKit properly first. Maybe I should just learn it, ha!
With that being said, do I think SwiftUI is really promising? Yes. Do I still use it? Yes. And hopefully I’ll actually launch my app in the near future!
What’s your experience with SwiftUI?
-Jesse