Thursday, September 11, 2025
HomeiOS Developmentios - SwiftUI PhotosPicker - get the scale of picked merchandise in...

ios – SwiftUI PhotosPicker – get the scale of picked merchandise in Kilobytes


var physique: some View {
    
    PhotosPicker(choice: $selectedItem, matching: .any(of: [.images, .videos]), photoLibrary: .shared()){
        Picture(systemName: "digicam.fill")
            .resizable()
            .aspectRatio(contentMode: .match)
            .body(top: 20)
            .padding(2)

    }
    .onChange(of: selectedItem) { newItem in
        
        // merchandise dimension in kilobytes?
    }
}

Is there a technique to get the scale of selectedItem in Kilobytes?

I understand how to do it by discovering out the URL of the merchandise first after which the scale of it by the URL, however that is kinda a dumb workaround because the merchandise is already chosen and it is also kinda sluggish.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments