Widgets
do not have animation or custom interactions, but we can deep link from our widget
into our app. systemSmall
widgets are one large tap area, while systemMedium
and systemLarge
can use the new SwiftUI link API
to create tappable zones within the widget.

Demo ; using Link
- in your widget extension.
struct YourWidgetEntryView : View {
var entry: Provider.Entry
@Environment(\.widgetFamily) var family //<- here
@ViewBuilder
var body: some View {
switch family {
case .systemSmall:
Text("Small") //.systemSmall widgets are one large tap area
default:
HStack{
Link(destination: URL(string: "game:///link1")!, label: {
Text("Link1")
})
Spacer()
Link(destination: URL(string: "game:///link2")!, label: {
Text("Link2")
})
Spacer()
Link(destination: URL(string: "game:///link3")!, label: {
Text("Link3")
})
}
.padding()
}
}
}
- in your app
struct ContentView: View {
@State var linkOne: Bool = false
@State var linkTwo: Bool = false
@State var linkThree: Bool = false
var body: some View {
NavigationView {
List {
NavigationLink(
destination: Text("Link1-View"), isActive: $linkOne) {
Text("Link1")
}
NavigationLink(
destination: Text("Link2-View"), isActive: $linkTwo) {
Text("Link2")
}
NavigationLink(
destination: Text("Link3-View"), isActive: $linkThree) {
Text("Link3")
}
}
.navigationBarTitle("Links")
.onOpenURL(perform: { (url) in
self.linkOne = url == URL(string: "game:///link1")!
self.linkTwo = url == URL(string: "game:///link2")!
self.linkThree = url == URL(string: "game:///link3")!
})
}
}
}