Your Second iOS & SwiftUI App

Nov 4 2021 · Swift 5.5, iOS 15, Xcode 13

Part 2: Data Flow

14. Confirmation Dialogs

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 13. Color Schemes Next episode: 15. Challenge: Image Deletion Button

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

At this point, you’re providing a way for users to set images for books, and update them. But there may be cases where they’d like to delete their custom images, and go back to the default.

      PHPickerViewController.View(image: $image)
    }
    .confirmationDialog(<#T##title: StringProtocol##StringProtocol#>, isPresented: <#T##Binding<Bool>#>, actions: <#T##() -> View#>, message: <#T##() -> View#>)
  }
    .confirmationDialog(
      "Delete image for \(book.title)?",
image: .constant(nil))
.alert(isPresented: .constant(true)) {
      isPresented: .constant(true)) {
        <#code#>
      } message: {
        🟩Text("Delete image for \(book.title)?")
      }
Button("Delete")
Button("Delete", role: .destructive)
Button("Delete", role: .destructive) { image = nil }