titleKey: dialog 에 대해 설명할 수 있는 제목

isPresented: 설정된 데이터의 값이 바뀌게 되면 confimationDialog View 가 나타납니다.

titleVisibility: 제목의 투명도(가시성) 설정

actions: 어떤 작업을 할지 Content 를 설정합니다.

struct ContentView: View {
    @State private var showDialog = false
    var body: some View {
        Button("Tap to show alert") {
            showDialog = true
        }
        .confirmationDialog("Email", isPresented: $showDialog) {
            Button("Move to Inbox", role: .none) {}
            Button("Delete", role: .destructive) {}
            Button("Cancle", role: .cancel) {}
        } message: {
            Text("What do you want to do with the message?")
        }
    }
}

 

'SwiftUI' 카테고리의 다른 글

horizontalSizeClass (make size different layout)  (0) 2023.12.19
Tab View, badge  (0) 2023.12.19
Alert View  (0) 2023.12.19
Modal View (sheet)  (0) 2023.12.19
Custom Navigation Button  (0) 2023.12.18
ytw_developer