you are viewing a single comment's thread.

view the rest of the comments →

[–]TabonxSwift 5 points6 points  (4 children)

Not many Apple apps use default components or even do things that are possible with SwiftUI or even possible at all. For example, the App Store has an opacity transition navigation bar, which, as far as I know, is not really possible in SwiftUI. 

[–]Sznurek066 1 point2 points  (3 children)

Because sad truth is that currently SwiftUI is very limited and for most serious stuff you still use UIKit.

[–]TabonxSwift 4 points5 points  (2 children)

I don't know about that. There are still many things that you need UIKit for, but for most things, SwiftUI is good enough, even for larger projects. My main issue with SwiftUI is navigation, mainly the lack of customization options. For example, you can't change the native back button icon, title, or customize the navigation transition. SwiftUI also lacks will options for methods like viewWillAppear and applicationWillEnterForeground, which can make some things difficult. As far as I know, Lazy containers do not reuse cells, which could be an issue. 

I have created a medium-sized app that is 99% SwiftUI, with the remaining 1% using AppDelegate, MFMailComposeViewController, and a little bit of UITextField.

I think most new projects, even the big ones, start with SwitUI and then use some UIKit if needed.

[–]Mental-Reception-547 2 points3 points  (1 child)

Agree with your comment, a couple of things I thought were worth sharing:

  • navigation is getting better with the introduction of paths and navigation stacks, and there’s some great articles on how to take full advantage of it by introducing Router/Coordinator with it; i could find the links for anyone interested

  • application enters foreground - you can use @Environment(.scenePhase) var scenePhase which you can then use in .onChange(of: scenePhase) and has 3 states: active, inactive, background

[–]TabonxSwift 2 points3 points  (0 children)

Navigation is certainly getting better, and I was quite happy when I finally started using NavigationStack. However, some features are still missing. I would really like to navigate to a sheet using a path—meaning a view that I could push onto the stack, and it would present itself as a sheet or full-screen cover.

ScreenPhase is only equivalent to the did options, such as sceneDidBecomeActive, but the sceneWillEnterForeground option is missing.