var body: some View {
PhotosPicker(selection: $selectedItem, matching: .any(of: [.images, .videos]), photoLibrary: .shared()){
Image(systemName: "camera.fill")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(height: 20)
.padding(2)
}
.onChange(of: selectedItem) { newItem in
// item size in kilobytes?
}
}
Is there a way to get the size of selectedItem
in Kilobytes?
I know how to do it by finding out the URL of the item first and then the size of it by the URL, but this is kinda a dumb workaround since the item is already selected and it’s also kinda slow.