struct ContentView: View {
@State var isModal: Bool = false
var body: some View {
Button(action: {
isModal = true
}) {
Text("Sheet テスト")
}
.sheet(isPresented: $isModal){
SomeView()
}
}
}
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触ると、全然頭がついていけないな
少しずつでも毎日継続してやらないと駄目だ