URL from iOS ImagePicker

Hey guys. I am trying to get the url out of an image selected from an imagePicker in swiftui (target: iPhone). Any ideas on how to do this?

You can use the FileRepresentation API:

struct ReceivedImage: Transferable {
    let url: URL
    static var transferRepresentation: some TransferRepresentation {
        FileRepresentation(importedContentType: .image) { received in
            let copy: URL = URL(fileURLWithPath: "<#...#>")
            try FileManager.default.copyItem(at: received.file, to: copy)
            return Self.init(url: copy)
        }
    }
}
URL from iOS ImagePicker
 
 
Q