Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing required module 'SDWebImage' when using an XCFramework deployed through spm with dependencies #350

Open
Yoojin99 opened this issue Mar 13, 2025 · 0 comments

Comments

@Yoojin99
Copy link

Yoojin99 commented Mar 13, 2025

Hi, all.

I have a xcframework that has a dependency on 'SDWebImageSwiftUI'. I deployed it through SPM, and I downloaded it with SPM in another project.

When I build it, it shows 'Missing required module 'SDWebImage'' error at the xcframework's swiftinterface file.

Below picture is a swiftinterface file of my xcframework.

Image

Steps to reproduce

  1. Create project that depends on 'SDWebImageSwiftUI'.
  2. Create xcframework from that project.
xcodebuild archive \
    -workspace SimpleFramework.xcworkspace \
    -scheme "SimpleFramework" \
    -destination "generic/platform=iOS" \
    -archivePath "./SimpleFramework-iphoneos.xcarchive" \
    -sdk iphoneos \
    SKIP_INSTALL=NO \
    BUILD_LIBRARY_FOR_DISTRIBUTION=YES

xcodebuild archive \
    -workspace SimpleFramework.xcworkspace \
    -scheme "SimpleFramework" \
    -archivePath "./SimpleFramework-iphonesimulator.xcarchive" \
    -sdk "iphonesimulator" \
    SKIP_INSTALL=NO \
    BUILD_LIBRARY_FOR_DISTRIBUTION=YES

xcodebuild -create-xcframework \
    -framework "./SimpleFramework-iphoneos.xcarchive/Products/Library/Frameworks/SimpleFramework.framework" \
    -framework "./SimpleFramework-iphonesimulator.xcarchive/Products/Library/Frameworks/SimpleFramework.framework" \
    -output "./SimpleFramework.xcframework"
  1. Embed xcframework in Swift package and deploy.
// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "SimplePackage",
    platforms: [.iOS(.v16)],
    products: [
        .library(
            name: "SimplePackage",
            targets: ["SimplePackage"]),
    ],
    dependencies: [
        .package(url: "https://github.com/SDWebImage/SDWebImageSwiftUI", from: "3.1.3"),
    ],
    targets: [
        .binaryTarget(
            name: "SimpleFramework", // My Framework that has dependency on SDWebImageSwiftUI
            path: "Sources/SimpleFramework.xcframework"
        ),
        .target(
            name: "SimplePackage",
            dependencies: [
                "SimpleFramework",
                
                "SDWebImageSwiftUI"

            ]
        )
    ]
)
  1. Download swift package from another project and import my framework.

I've checked 'SDWebImage' is downloaded. How can I fix this? Is there anything wrong with the setup? I also tried adding depdency of 'SDWebImage' in Package.swift file, but error remains same.

Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant