Get photo metadata with PHPicker in SwiftUI
With iOS 14.0 a new photo picker PHPicker
was introduced. In this post I will show you how to get and show photo metadata, the PHAsset, containing information like creation date and the location of where the photo was taken, in SwiftUI.
When using the PHPickerViewControllerDelegate
the metadata can be obtained the following way:
Simple CustomPhotoPickerView
example
I created a full example app of how to get and display photo metadata with the new PHPicker
in iOS 14.
It can be cloned here:
Link to GitHub repo at simple branch which only contains the basics.
Link to GitHub repo at main branch which has the UI shown here.
As the PHPickerView
is a UIView the UIViewControllerRepresentable
protocol must be used for using it with SwiftUI.