Youngminah/TIL

PHPicker iOS14

Closed this issue · 0 comments

  • PHPicker는 UIImagePickerController를 모-던한 방식으로 대체한 것
  • multiselect / zoom in or out / search 를 지원
  • 사진 저장이나 접근에서 UIImagePickerController 대신 PHPickerViewController를 사용하라고 권함
  • 아직까지 iOS14전에는 분기처리해야함

image

@IBAction func buttonDidTap(_ sender: Any) {
      var configuration = PHPickerConfiguration()
      configuration.selectionLimit = 0
      configuration.filter = .any(of: [.images, .videos])
        
      let picker = PHPickerViewController(configuration: configuration)
      picker.delegate = self
      self.present(picker, animated: true, completion: nil)
}

wwdc2020