SwiftUI raw image conversion

There seems to be a difference to the way iPadOS and macOS handle raw image files (tested with Fujifilm X-T3 uncompressed RAF file - included on the compatible list).

Running the following code (with url set to the file location of the RAF file) on the iPad displays the preview jpeg embedded in the RAF file whereas on the mac the raw data are converted:

AsyncImage(url: item.url) { phase in
      if let image = phase.image {
       image.resizable().aspectRatio(contentMode: .fit)
      } else if phase.error != nil {
       Color.red
      } else {
       Color.blue
      }
     }

Am I missing something or is this the expected behaviour and is it documented somewhere?

Apparently the code should not have used AsyncImage for a local file - but the logic remains the same

Revised code with raw file taken from Xcode asset (Still have the same issue)


struct ContentView: View {
  @State private var image: Image?

  var body: some View {
    VStack {
      image?
        .resizable()
        .scaledToFit()
    }
    .onAppear(perform: loadImage)
  }

  func loadImage() {
    guard let asset = NSDataAsset(name: "Rawsample") else { return }
    let data = asset.data
    image = Image(uiImage:UIImage(data:data)!)
  }
}
SwiftUI raw image conversion
 
 
Q