Image from Swift Package Displays in Storyboard But Not in Simulator or Device

When trying to using an image from a Swift Package within Interface Builder / Storyboard Scene:
  • In the "Attributes Inspector" the images are displayed in the dropdown for placing within the UIImageView

  • When the the image is selected from the dropdown it is populated within the UIImage object

  • When the iOS app is side-loaded to an iPad or the Simulator, the image does not appear within the UIImage object

  • I have created a UIImage extension within the Swift Package containing corresponding color name properties populate in "Images.xcassets" -> when using these properties to populate the UIImage object within the Swift class via code the image displays successfully

Baseline:
  • Xcode version -> 12.4

  • iPadOS 14.4

  • [Package] -> Image sources within the package: "Sources" -> "Package Name" -> "Resources" -> "Images.xcassets"

  • [Package] -> Has "resources: [.process("Resources")]" added to "Package -> targets -> .target"


Question:
  • Is this a bug in within Xcode 12.*, by Apple/Xcode design or am I missing a step?

That works well, in Xcode 12.4 and iPad 14.4 simulator. No bug (except maybe somewhere in your own code).

Is it a png image ?

Are you sure you do not reset the image of the UIImageView in code ?
Thanks for your reply "Claude31".

The image is a vector PDF with:
  • "Preserve Vector Data" = checked

  • "Appearances" = none

  • "Scales" = Single Scale

I created a "test package" and a "test iOS project" just to test this functionality to try and find the issue. The only code in the VC class is an empty viewDidLoad() and there is only one scene in the storyboard.

I did notice this log just now: "Could not load the "circle_vector" image referenced from a nib in the bundle with identifier "com.*.*" - I plan to start searching for what that could be referencing.

I have to implement below function in package and set image programtically

public func AMImage(named name: String) -> UIImage? {

  return UIImage(named: name, in: Bundle.module, compatibleWith: nil)

}

Is there an open feedback item for this. I'm currently seeing the same behavior in Xcode 13.1. It seems to be a bug with resource bundles loading via xibs/storyboards.

I am experiencing the same thing with a PNG file in an asset catalog (Xcode 13.2.1). Colors work fine. The only thing that fixed it for me was to add the asset file to the main app's Copy Bundle Resources build phase.

I'm also having @IBDesignables fail to build in Interface Builder with error Designables failed: The build product does not exist in the file system.

Image from Swift Package Displays in Storyboard But Not in Simulator or Device
 
 
Q