Skip to content

Instantly share code, notes, and snippets.

@hirauchg
Created August 20, 2020 13:45
Show Gist options
  • Save hirauchg/d9556441148ad871f90c06f071312570 to your computer and use it in GitHub Desktop.
Save hirauchg/d9556441148ad871f90c06f071312570 to your computer and use it in GitHub Desktop.
有効・無効の切り替え
struct FirstView: View {
@State var isDisable: Bool = false
var body: some View {
NavigationView {
VStack {
Toggle(isOn: $isDisable) {
Text("リンクを無効にする")
}.frame(width: 220)
NavigationLink("画面遷移", destination: SecondView()).disabled(isDisable)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment