Show image in vision pro app

simple question. how can I display an image in a vision pro scene? this does not work:

struct ContentView: View { var body: some View { VStack { Image( "IMG_3984.jpg")

        VStack {
            Text( "Hello")
            
        }
    }
}

Replies

Drag and drop an image into Assets.xcassets in your project. I used "SoccerBall.png".

Then call it in ContentView like this:

(Note that you should not include the file extension in Image. Maybe that's why yours isn't working. Try using Image("IMG_3984"))

import SwiftUI
import RealityKit
import RealityKitContent

struct ContentView: View {
    var body: some View {
        VStack {
            //Model3D(named: "Scene", bundle: realityKitContentBundle)
           //     .padding(.bottom, 50)

            Text("Hello, world!")
            Image("SoccerBall").resizable().scaledToFit()
        }
        .padding()
    }
}

#Preview(windowStyle: .automatic) {
    ContentView()
}