[ad_1]
I’m able to get picture knowledge utilizing the brand new PhotosPicker in iOS 16 / macOS Ventura. Here’s what I do:
PhotosPicker(choice: $selectedPhotosPickerItem, matching: .any(of: [.images]), photoLibrary: .shared()) {
Textual content("Choose a photograph")
}
.onChange(of: selectedPhotosPickerItem) { newItems in for newItem in newItems {
Activity {
if let knowledge = attempt? await newItem.loadTransferable(sort: Knowledge.self) {
... = UIImage(knowledge: knowledge)
}
}
}
}
Nonetheless, I would like some extra details about the picture. If I might fetch the PHAsset one way or the other, that might be superior or a minimum of the unique creation date to begin with. PHAsset doesn’t conform to Transferable. Is there possibly any option to fetch PHAsset solely figuring out the picture knowledge? Perhaps with a hash?
[ad_2]
