SwfitUI and Catalyst
I used SwiftUI quite a bit at work but much more on my side project which is an iPad / Catalyst app Hyperdeck.
Since my use case (layout of complex slides) differs from the standard uses of SwiftUI (nested lists or collections of items and detail views), I can say less about the viability of building these nested lists. However I do have a lot of feedback about SwiftUI evolution in general.
- Error reporting and build times have much improved and are mostly ok nowadays
- Previews still don’t work well for a reasonably sized app, except if you go out of your way to keep the dependencies small and have the UI be its own framework (which is good advice in general but not always easily possible)
- SwiftUI’s layout system is less flexible than what UIKit can do. You can hoist UIKit views in SwiftUI but there’re issues where the UIKit View cannot know the available size that it should operate it (e.g. there’s no SwiftUI equivalent to ‘sizeThatFits:’) you’re still a bit limited here (for very complex responsive layouts).
- Instead of placing UIKit Views in SwiftUI what I’m doing is placing SwiftUI Views in UIKit. This works well and gives me more flexibility.
- SwiftUI has a lot of benefits that make it a joy to work with. Easy animations, dark / light mode, very fast layout, great selection of views/widgets.
- There’re still weird layout bugs from time to time. In comparison to UIKit there’s usually no way to engineer around them. This is much more pervasive on macOS though.
- For certain use cases, getting good performance is a bit tricky. However, a similar usecase with UIKit would also be tricky. Sometimes a really smooth UI takes a bit more dedication.
The major downside, as of today (for me) is that SwiftUI is not downwards compatible. The newest version (SwiftUI 3) will only work on the newest iOS releases but adds criticial features and fixes important bugs. If your product is supposed to also run on older iOS devices (say, down to iOS 13), stay away from SwiftUI as the old version has a lot of weird issues and bugs.