OK. Replace with this:
struct ContentView: View {
@State var checknewHour: String = "0"
@State var checknewMinute: String = "0"
@State private var action: Int? = 0
var body: some View {
NavigationView { // error is here
Form {
Group {
List {
VStack {
NavigationLink("", destination: OtherView(), tag: 1, selection: $action)
VStack {
ScrollView(.vertical) {
VStack(spacing: 13) {
ForEach(0..<1) {_ in TextField("Enter hour", text: $checknewHour)
.keyboardType(.decimalPad)
.font(.system(size: 25))
Text("\(checknewHour) $ Hour")
.foregroundColor(.purple)
.font(.system(size: 25))
TextField("Enter minute",text:$checknewMinute)
.keyboardType(.decimalPad)
.font(.system(size: 25))
Text("\(checknewMinute) $ Minute")
.foregroundColor(.purple)
.font(.system(size: 25))
Text("Calculate Pace")
.bold()
.frame(width: 280, height: 50)
.background(Color.init(red: 0.818, green: 0.688, blue: 0.095))
.foregroundColor(.white)
.cornerRadius(10)
.navigationTitle ("Pace Calculator")
// .navigationBarTitleDisplayMode(.inline)
.padding(5)
.onTapGesture {
self.action = 1
}
}
}
}
}
}
}
}
}
}
}
}
You can also replace the last Text by a button with a link. It is probably better.
struct ContentView: View {
@State var checknewHour: String = "0"
@State var checknewMinute: String = "0"
// @State private var action: Int? = 0
var body: some View {
NavigationView { // error is here
Form {
Group {
List {
VStack {
ScrollView(.vertical) {
VStack(spacing: 13) {
ForEach(0..<1) {_ in
TextField("Enter hour", text: $checknewHour)
.keyboardType(.decimalPad)
.font(.system(size: 25))
Text("\(checknewHour) $ Hour")
.foregroundColor(.purple)
.font(.system(size: 25))
TextField("Enter minute",text:$checknewMinute)
.keyboardType(.decimalPad)
.font(.system(size: 25))
Text("\(checknewMinute) $ Minute")
.foregroundColor(.purple)
.font(.system(size: 25))
Button(action: {
}, label: {
NavigationLink(destination: OtherView()) {
Text("Calculate Pace")
.bold()
.frame(width: 280, height: 50)
.background(Color.init(red: 0.818, green: 0.688, blue: 0.095))
.foregroundColor(.white)
.cornerRadius(10)
}
})
}
}
}
}
}
}
}
}
}
}