I dev a web, now want to dev iOS app.
my idea is: by menu change new url
struct ContentView: View {
var body: some View {
Webview(url: "https://readmorejoy.com")
HStack {
Menu("Menu") {
Button("menu1", action: {
// Webview(url: "https://readmorejoy.com")
})
Button("menu2", action: {})
Button("menu3", action: {})
}
}
}
}
Here it is
struct ContentView: View {
@State private var urlString = "https://readmorejoy.com" // << initial !!
var body: some View {
Webview(url: urlString) // << use !!
HStack {
Menu("Menu") {
Button("menu1", action: {
self.urlString = "https://readmorejoy.com" // << update !!
})
Button("menu2", action: {})
Button("menu3", action: {})
}
}
}
}