Hi,
I am developing an app that has 5 buttons on the screen. Tapping on a button would take you to another viewController.
How would I do this in SwiftUI?
Here's my code:
import SwiftUI
struct MainSwiftUI : View {
var body: some View {
VStack {
Button(action: {}) {
//
Text("Pick One")
.cornerRadius(40)
}
.background(Color .red)
Button(action: {}) {
// action
Text("Pick Two")
.cornerRadius(40)
}
.background(Color .green)
Button(action: {}) {
// action
Text("Pick Three")
.cornerRadius(40)
}
.background(Color .blue)
Button(action: {}) {
// action
Text("Disclaimer")
.cornerRadius(40)
}
.background(Color.black)
Button(action: {}) {
// action
Text("About")
.cornerRadius(40)
}
.background(Color.black)
}
}
}
#if DEBUG
struct MainSwiftUI_Previews : PreviewProvider {
static var previews: some View {
Group {
MainSwiftUI()
.previewDevice("Apple Watch Series 4 - 40mm")
MainSwiftUI()
.previewDevice("Apple Watch Series 4 - 44mm")
}
}
}
#endif