Post

Replies

Boosts

Views

Activity

Reply to SwiftUI raw image conversion
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)!)   } }
Dec ’21