Post

Replies

Boosts

Views

Activity

Reply to Load NavigationLink destination lazily
You can use LazyView (by Chris Eidhof): https://gist.github.com/chriseidhof/d2fcafb53843df343fe07f3c0dac41d5 Luca Bernardi, a SwiftUI engineer, said in a Twitter thread this is how SwiftUI works: Exactly, SwiftUI expects view creation to be cheap: the system can recreate views often. For example, allocating NSFormatter in the init is not a good: you’ll pay the cost of heap allocation (and initialization) every time the view hierarchy is updated. (I can't link the referenced tweet here but the reference id of the tweet is 1144312093597769728.) That said, I'd like to understand why it works like this for NavigationLink but not for views presented modally, and why not give us, the developers, the option built-in in SwiftUI, so we are left to choose the approach that fits best for us.
Jun ’20
Reply to How to tackle Routing in a SwitUI app (aka Deep Linking)
You can use LazyView (by Chris Eidhof): https://gist.github.com/chriseidhof/d2fcafb53843df343fe07f3c0dac41d5 Luca Bernardi, a SwiftUI engineer, said in a Twitter thread this is how SwiftUI works: Exactly, SwiftUI expects view creation to be cheap: the system can recreate views often. For example, allocating NSFormatter in the init is not a good: you’ll pay the cost of heap allocation (and initialization) every time the view hierarchy is updated. (I can't link the referenced tweet here but the reference id of the tweet is 1144312093597769728.) That said, I'd like to understand why it works like this for NavigationLink but not for views presented modally, and why not give us, the developers, the option built-in in SwiftUI, so we are left to choose the approach that fits best for us.
Jun ’20
Reply to How to tackle Routing in a SwitUI app (aka Deep Linking)
It looks like you show a deeplink example in Fruta app (https://developer.apple.com/documentation/swiftui/fruta_building_a_feature-rich_app_with_swiftui, check out onContinueUserActivity in FrutaApp.swift). Although it's good that I finally see an example from Apple, I think the community will benefit if it is covered in an article or documentation piece.
Jun ’20