50.2 Adding Deep Link Support to the App
When an app is launched via a deep link, it is passed a URL object which may be accessed via the top level view in the main content view. This URL can then be used to present different content to the user than would normally be displayed.
The first step in adding deep link support to the WidgetDemo app is to modify the ContentView.swift file to add some state properties. These variables will be used to control which weather detail view instance is displayed when the app is opened by a URL:
import SwiftUI
struct ContentView: View {
@State private var hailActive: Bool = false
@State private var thunderActive: Bool = false
@State private var tropicalActive: Bool = false
var body: some View {
NavigationView {
...