Thursday, September 11, 2025
HomeiOS Developmentios - Unable to Reference XCFramework Bundle

ios – Unable to Reference XCFramework Bundle


I’m at the moment creating an SDK in XCFramework format, however I’m going through points displaying photographs. The pattern repository may be discovered right here.

The Instance goal is the SDK and contains an Property.xcassets folder. Inside Property.xcassets, there’s a picture named neko.png, which I’m attempting to show in MyImage.swift.

Right here’s the related code snippet from MyImage.swift:

public var physique: some View {
    HStack {
        Picture("neko")
            .resizable()
            .body(width: 100, peak: 100)
        Picture("neko", bundle: Bundle(identifier: "com.instance.Instance"))
            .resizable()
            .body(width: 100, peak: 100)
        Picture("neko", bundle: Bundle(for: Dummy.self))
            .resizable()
            .body(width: 100, peak: 100)
    }
}

The ExampleApp goal is an iOS app that simulates the mixing of the SDK. I’ve linked Instance.framework through “Frameworks, Libraries, and Embedded Content material.” In ContentView.swift, I name MyImage():

var physique: some View {
    VStack {
        MyImage()
        Picture(systemName: "globe")
            .imageScale(.massive)
            .foregroundStyle(.tint)
        Textual content("Hey, world!")
    }
    .padding()
}

Nevertheless, when operating ExampleApp, I encounter the next error, and the picture doesn’t show:

 No picture named 'neko' present in asset catalog for /Customers/xxxxx/Library/Developer/CoreSimulator/Gadgets/xxxxx/knowledge/Containers/Bundle/Software/xxxxx/ExampleApp.app

The picture will not be displayed

Including neko.png to ExampleApp’s Property.xcassets resolves the problem.

The picture is displayed

Plainly I’m not passing the bundle accurately when calling Picture() in MyImage.swift. Moreover, after I run print(Bundle.allFrameworks) inside ExampleApp, Instance.framework doesn’t seem like included.
I additionally tried including the .xcframework constructed utilizing xcodebuild to “Frameworks, Libraries, and Embedded Content material” as an alternative of Instance.framework, however it didn’t resolve the problem.

If anybody has insights on resolve this, I’d significantly recognize it!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments