Created
March 4, 2020 14:33
-
-
Save azamsharp/092e3f89b42aeda92d6a9f671e90da0a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
@ObservedObject private var registrationVM = RegistrationViewModel() | |
var body: some View { | |
NavigationView { | |
Form { | |
VStack(spacing: 10) { | |
TextField("First name", text: $registrationVM.firstname.bound) | |
.textFieldStyle(RoundedBorderTextFieldStyle()) | |
TextField("Last name", text: $registrationVM.lastname.bound) | |
.textFieldStyle(RoundedBorderTextFieldStyle()) | |
TextField("Username", text: $registrationVM.username.bound) | |
.textFieldStyle(RoundedBorderTextFieldStyle()) | |
SecureField("Password", text: $registrationVM.password.bound) | |
.textFieldStyle(RoundedBorderTextFieldStyle()) | |
Button("Register") { | |
self.registrationVM.validate() | |
}.padding(10) | |
.background(Color.blue) | |
.cornerRadius(6) | |
.foregroundColor(Color.white) | |
BrokenRulesView(brokenRules: registrationVM.brokenRules) | |
} | |
} | |
.navigationBarTitle("Registration") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment