Your Second iOS & SwiftUI App

Nov 4 2021 Swift 5.5, iOS 15, Xcode 13

Part 2: Data Flow

11. Modal Views

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: 10. Introduction Next episode: 12. Image Binding

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.

The next feature we’re going to work on will let users add their own images to the app from the Detail View.

import SwiftUI
  ]

  var images: [Book: Image] = [:]
}
struct Book: Hashable {
List(Library().sortedBooks, id: \.self) { book in
extension PHPickerViewController {
  struct View {
    @Binding var image: UIImage?
  }
}
  let book: Book
  @State var showingImagePicker

  var body: some View {
  @State var modalIsPresented👉 = false
      )

      VStack {
        Book.Image(title: book.title)
      }
      
      Spacer()
        Book.Image(title: book.title)
        
        Button(<#T##title: StringProtocol##StringProtocol#>, action: <#T##() -> Void#>)
      }
Button("Update Image…", action: <#T##() -> Void#>)
        Book.Image(title: book.title)
        
        Button("Update Image…") {
          showingImagePicker = true
        }
      }
          showingImagePicker = true
        }
        .padding()
      }
    .padding()
    .sheet(isPresented: /*@START_MENU_TOKEN@*//*@PLACEHOLDER=Is Presented@*/.constant(false)/*@END_MENU_TOKEN@*/) {
      /*@START_MENU_TOKEN@*//*@PLACEHOLDER=Content@*/Text("Sheet Content")/*@END_MENU_TOKEN@*/
    }
.sheet(isPresented: 👉$showingImagePicker) {
/// THE SOFTWARE.

import class PhotosUI.PHPickerViewController
import SwiftUI
    .sheet(isPresented: $showingImagePicker) {
      PHPickerViewController.View(image: <#T##Binding<Image?>#>)
    }
struct DetailView: View {
  let book: Book
  @Binding var image: Image?
  @State var showingImagePicker = false
PHPickerViewController.View(image: $image)
DetailView(book: .init(), image: .constant(nil))