Code:
struct ContentView: View {
@State private var isVisible = false
@State private var username = ""
@State private var password = ""
var body: some View {
NavigationView {
Form {
Toggle(isOn: $isVisible.animation()) {
if isVisible {
Text("Hide Form")
} else {
Text("Show Form")
}
}
if isVisible {
Section(header: Text("Please enter your information")) {
TextField("Username", text: $username)
SecureField("Password", text: $password)
}
}
}
}
.navigationBarTitle(Text("User info"))
}
}
Follow me on:
Comments