Trouble Integrating my XCFramework (with dylib) with SPM


I'm encountering a challenge while trying to integrate a custom XCFramework into a Swift Package Manager (SPM). I have an XCFramework named MyFramework.xcframework, designed for macOS platform (dylib as arm64/x86_64 written in C). The way I create my xcframework:

xcodebuild -create-xcframework -library ./mylib.dylib -headers includes -output MyFramework.xcframework

After integrating the XCFramework with my SPM, I am unable to successfully import and use it in my project. My Package.swift

import PackageDescription

let package = Package(
    name: "TestProject",
    platforms: [
    products: [
            name: "MyProject",
            targets: ["Swift"])
    targets: [
            name: "MyFramework",
            path: "MyFramework.xcframework"
            name: "Swift",
            dependencies: ["MyFramework"]
// test.swift (under Sources/Swift)
import MyFramework // no such module

Here is a snippet of the info.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

Not sure if I am missing something obvious.


It turned out that I had a typo in my module.modulemap.