1 2 3 4 5 6 7 8 9 10 11 12 13 14 | struct ContentView: View { @State var isModal: Bool = false var body: some View { Button(action: { isModal = true }) { Text("Sheet テスト") } .sheet(isPresented: $isModal){ SomeView() } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | struct ContentView: View { @State var isModal: Bool = false @State var counter:Int = 0 var body: some View { VStack { Button(action: { isModal = true }) { Text("Sheetテスト") } .sheet(isPresented: $isModal, onDismiss: {countUp(}){ SomeView() } .disabled(counter >= 3) Text("回数\(counter)") .font(.title) .paddin() } } func countUp(){ counter += 1 } } |
なんか久しぶりにSwift触ると、全然頭がついていけないな
少しずつでも毎日継続してやらないと駄目だ