Does someone know how to add a function like - if the selected age < 18 - the User is unable to hit the continue button and won't be navigated to the next page ? Would help me a lot.
My Code:
import SwiftUI
struct DateOfBirthView: View {
@ State private var birthdate = Date()
var body: some View {
VStack {
DatePicker("date of birth", selection: $birthdate,
displayedComponents: [.date])
.font(.title3)
.padding()
.background(RoundedRectangle(cornerRadius: 10).fill(Color.gray.opacity(0.1)))
.padding(.top, 15)
Text("you must be at least 18 to Register")
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.leading)
CustomNavLink(destination: SelectGenderView()
.customNavigationTitle("Registration"),
label: {
DefaultButton (title: "continue")
.padding(.top, 15)
})
Spacer()
}
.padding (.horizontal, 25)
}
}