-
What's new in the Photos picker
PHPicker provides simple and secure integration between your app and the system Photos library. Learn how SwiftUI and Transferable can help you offer integration across iOS, iPadOS, macOS, and watchOS.
We'll also show you how you can use AppKit and NSOpenPanel to bring the Photos picker on Mac into your macOS apps.
For even more on the Photos picker, watch "Improve access to Photos in your app" from WWDC21.Ressources
Vidéos connexes
WWDC23
WWDC22
WWDC21
WWDC20
-
Rechercher dans cette vidéo…
-
-
0:01 - PHPicker Example (UIKit)
var configuration = PHPickerConfiguration() configuration.filter = .images configuration.selection = .ordered configuration.selectionLimit = 10 let picker = PHPickerViewController(configuration: configuration) -
0:02 - PHPickerFilter
var configuration = PHPickerConfiguration() // iOS 15 // Shows videos and Live Photos configuration.filter = .any(of: [.videos, .livePhotos]) // New: iOS 15 // Shows screenshots only configuration.filter = .screenshots // New: iOS 15 // Shows images excluding screenshots configuration.filter = .all(of: [.images, .not(.screenshots)]) // New: iOS 16 // Shows cinematic videos configuration.filter = .cinematicVideos -
0:03 - PHPicker Example (AppKit)
var configuration = PHPickerConfiguration() configuration.filter = .images configuration.selectionLimit = 10 let picker = PHPickerViewController(configuration: configuration) -
0:04 - PhotosPicker Example (SwiftUI)
struct ContentView: View { @Binding selection: [PhotosPickerItem] var body: some View { PhotosPicker( selection: $selection, matching: .images ) { Text("Select Photos") } } }
-