I have an app that deep links, so first I have a loading or home view rendered:
@main
struct AppMain: App {
var body: some Scene {
WindowGroup {
LoadingView()
.onContinueUserActivity(NSUserActivityTypeBrowsingWeb, perform: handleUserActivity)
}
}
}
However, in my handleUserActivity
that responds to the activity, how do I update the screen based on the activity parameters? For example, I've extracted a value and would like to render the view from here:
private extension AppMain {
func handleUserActivity(_ userActivity: NSUserActivity) {
guard let url = userActivity.webpageURL,
let components = NSURLComponents(url: url, resolvingAgainstBaseURL: true),
let queryItems = components.queryItems
else {
return
}
if let modelID = queryItems.first(where: { $0.name == "id" })?.value {
SmoothieView(id: modelID) // TODO: How to I render view??
}
}
}
How can I replace the LoadingView
and display the SmoothieView
?