[ad_1]
I am utilizing this code to select video or picture utilizing PhotosPicker:
PhotosPicker(
choice: $selectedItem,
matching: matching: .any(of: [.images, .videos]),
photoLibrary: .shared()) {
Textual content("edit")
.padding(.horizontal, 18)
.padding(.vertical, 2)
.background(Colour.black.opacity(0.5))
.cornerRadius(12)
}
.onChange(of: selectedItem) { newItem in
Job {
if let knowledge = attempt? await newItem?.loadTransferable(kind: Information.self) {
selectedFileData = knowledge
// mimeType = ???
}
}
}
How can I discover out the mime Sort from the chosen file? I understand how to get it when I’ve the trail/url of the chosen file however I do not know the best way to get it with PhotosPicker both
[ad_2]
