Post

Replies

Boosts

Views

Activity

Reply to Preselect PhotoPickerItems from Image when reopening PhotosPicker
Thanks for your input. profileImage is something you can define yourself. All you get from the PhotoPicker is a Data object and nothing more. But, I was able to find the issue. Turns out, the localIdentifier was nil as I did not specify a photoLibrary when initializing the PhotosPicker. So if you initialize your PhotosPicker like that: PhotosPicker(selection: $viewModel.selectedPhotos, matching: .images) the localIdentifier will be nil. If you set a photoLibrary you will be able to properly retrieve the localIdentifier: PhotosPicker(selection: $selectedPhotos, matching: .images, photoLibrary: .shared()) Found that in the docs page for the localIdentifier itself: https://developer.apple.com/documentation/photosui/photospickeritem/itemidentifier
Jan ’25