SwiftUI [SwiftUI] No image named found in asset catalog for main bundle

SwiftUI [SwiftUI] No image named found in asset catalog for main bundle

SwiftUI 有两种载入图片方式

  • 一种放到Assets.xcassets 文件夹中
Image("文件名")
  • 一种直接放到项目中
Image(uiImage: UIImage(imageLiteralResourceName: "文件名.文件格式"))

问题解决

出现No image named found in asset catalog for main bundle问题通常是没有正确使用好载入方式


更多SwiftUI教程和代码关注专栏

  • 请关注我的专栏 SwiftUI教程与源码

你可能感兴趣的:(SwiftUI [SwiftUI] No image named found in asset catalog for main bundle)