SwiftUI 中加载bundle中的图片
import SwiftUI
struct ContentView: View {
    
    var body: some View {
        Group{
            if let resBundlePath = Bundle.main.path(forResource: "Resources", ofType: "bundle"),
               let resBundle = Bundle(path: resBundlePath),
               let uiImage = UIImage(named: "imagename", in: resBundle, with: nil){
                    Image(uiImage: uiImage)
                        .resizable()
                        .scaledToFit()
            }else{
                Color.red
            }
        }
    }
}
struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号