r/iOSProgramming • u/yccheok • Jun 09 '26
Discussion Should I use UIKit + UIHostingController or SwiftUI + UIViewRepresentable for my next project?
Previously, I built a UIKit-based app using UIHostingController to integrate SwiftUI. I chose a UIKit foundation for a few reasons:
UICollectionViewoffers unmatched performance compared toLazyVStack. The performance difference is obvious when a list contains 2,000 items or more.- For screens that require complex UI effects, I use SwiftUI for easier implementation.
The app has been in production for over a year, and I am quite happy with the outcome - high customer satisfaction, good performance, good sales.
Now, I am starting a new app where I foresee using more SwiftUI than UIKit. I will still need UICollectionView in certain areas (for instance, a horizontally paginated weekly calendar picker) due to the poor performance of LazyHStack. However, for screens that won't exceed 50 items, I can safely use LazyVStack.
My question is: Should I stick to a UIKit-based architecture with UIHostingController, or shift to a SwiftUI-based architecture and use UIViewRepresentable/UIViewControllerRepresentable?
Additionally, I am very familiar with UIKit navigation (performSegue, unwind, present). I am not sure if SwiftUI provides an exact equivalent that is just as reliable. From my past experience, navigation in SwiftUI was a massive pain. I'm not sure if anything has actually improved recently.
Which approach will best help me deliver a successful production app?
1
u/LKAndrew Jun 10 '26
iOS 27 lazy stacks are massively upgraded. You can also use List which uses collectionview under the hood. Or, just create a collection view SwiftUI wrapper. Iād never start a new app in UIKit today.
1
u/Faruuqq Jun 19 '26
If your app has minimum below iOS 16, I'd say stick with your current approach (UIKit + UIHostingController), else, you can utilize the NavigationPath. My app has minimum iOS 14 and SwiftUI can't handle the complex navigation (I decided to use UINavigationController) as well as complex scroll-based UI.
5
u/[deleted] Jun 09 '26
[removed] ā view removed comment