I am currently trying to make a widget with SwiftUI.
Let's say my code is like this:
struct WidgetView: View {
var data : DataProvider.Entry
var body: some View {
ZStack {
Image("Clicker")
.padding(.all, 15)
}.widgetURL(URL(string: "ClickerViewController"))
.padding(.all, 30)
.background(Color.green)
}
}
At the moment, tapping the widget opens the home screen of the app. Want to navigate to a specific screen.
supportedFamilies: .systemSmall - so need to use .widgetURL and not .Link
So where the URL is Clicker, how to navigate to viewController that is called ClickerViewController
?
How to handle these links? Any examples or explaining would help me and a lot of others in the near future I guess ;)
Thank you!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…