I think I’ve figured it out.
If you want to use SwiftUI and be happy, you should avoid things like NavigationView
, List
, Form
, .searchable
, .toolbar
, etc. Just use the most basic Text
and Button
and only layout using HStack
and VStack
.
The thing is, SwiftUI is very good for creating custom views (a view you make by combining multiple simpler views), but it’s not so good at customizing views. It’s good if the apps you make don’t follow the design conventions of system apps.
(Sidenote: What design conventions? Lol, the HIG is dead. Even many of Apple’s own apps are no longer following any conventions.)
But if you want to make a SwiftUI app that looks exactly like a system app, you’re probably going to have a bad time. This is because SwiftUI will give you a set of default spacings, colors, and sizes that are somehow different from those in the system apps. And they’re not customizable.
So the next time you find yourself thinking, “I wish I could configure this thing in a List
,” or “I wish NavigationView
could do that,” think about whether you can reimplement the functionalities with simpler components. Usually, you can. Most of the time, you just need to figure out the right padding numbers and colors to use.
Why do you need a NavigationSplitView
? Just use an HStack
with 2 views and a Divider
between them. Why do you need a navigation bar and toolbar? Just use a VStack
with views on top and bottom with a .background(.bar)
.
I did this when developing Medley, and I didn’t need to update the SwiftUI code. It still works after more than a year. (Probably because Apple doesn’t change the behavior of Stack
and Text
that often.) I’m now doing this quite a bit for Gibberish, too.