Your Second iOS & SwiftUI App

Nov 4 2021 Swift 5.5, iOS 15, Xcode 13

Part 2: Data Flow

15. Challenge: Image Deletion Button

Lesson Complete

Play Next Lesson
Next
Save for later
About this episode
See versions

See course reviews

See forum comments
Cinema mode Mark as Complete Download course materials
Previous episode: 14. Confirmation Dialogs Next episode: 16. Model Objects

This video was last updated on Nov 4 2021

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

You can unlock the rest of this video course, and our entire catalogue of books and videos, with a kodeco.com Professional subscription.

So, you can delete images, now? And you’ve got a button to go through with it, on your confirmation dialog… How about another button …to launch the dialog when you actually need it?!

.confirmationDialog(isPresented: .constant(true)) {
  @State var showingImagePicker = false
  @State var showingDialog = false

  var body: some View {
.confirmationDialoge(...., isPresented: $showingDialog) {
        .scaledToFit()

        HStack {
          Button("Update Image…") {
            showingImagePicker = true
          }
          .padding()
        }
      }

            showingImagePicker = true
          }
        }
        .padding()
        HStack {
          Button("Update Image…") {
            showingImagePicker = true
          }

          Button("Update Image…") {
            showingImagePicker = true
          }
Button("Delete Image…") {
Image") {
          Button("Delete Image") {
            showingDialog = true
          }
            showingDialog = true
          }

          Spacer()

          Button("Update Image…") {
        HStack {
          Spacer()

          Button("Delete Image") {
          Spacer()
        }
        .padding()
      HStack {
        if image != nil {
          Spacer()
          Button("Delete Image") { showingDialog = true }
        }