I'm having exact same issue here. Trying to incorporate 3rd party dependency (SQLite.swift) into my binaryTarget using wrapper target (firebase ios as an example: firebase-ios-sdk/Package.swift at master · firebase/firebase-ios-sdk · GitHub) like so:
let package = Package(
name: "{framework_name}",
products: [
.library(
name: "{framework_name}",
targets: ["{framework_name}SPMTarget"]
),
],
dependencies: [
.package(name: "SQLite.swift", url: "https://github.com/stephencelis/SQLite.swift.git", from: "0.13.3")
],
targets: [
.target(
name: "{framework_name}SPMTarget",
dependencies: [
.target(name: "{framework_name}SPMWrapper", condition: .when(platforms: [.iOS])),
],
path: "SwiftPM-PlatformExclude/{framework_name}SPMTarget"
),
.target(
name: "{framework_name}SPMWrapper",
dependencies: [
.target(name: "{framework_name}", condition: .when(platforms: [.iOS])),
.product(name: "SQLite", package: "SQLite.swift")
],
path: "{framework_name}SPMWrapper"
),
.binaryTarget(
name: "{framework_name}",
path: "Framework/{framework_name}.xcframework"
),
]
)
Without using @_implementationOnly import SQLite approach I got "Missing required module 'SQLiteObjc' kind of build error as a result.
Looking at SQLite.swift's Package.swift it looks like SQLiteObjc is a submodule:
let package = Package(
name: "SQLite.swift",
...
products: [
.library(
name: "SQLite",
targets: ["SQLite"]
)
],
targets: [
.target(
name: "SQLite",
dependencies: ["SQLiteObjc"],
...
),
.target(
name: "SQLiteObjc",
...
),
...
With @_implementationOnly import SQLite there is another thing. It looks like 3rd party framework is not linked although the dependency got imported to a Xcode project.
Here is the kind of error i am getting:
Library not loaded: @rpath/SQLite.framework/SQLite
Reason: tried: '{...}/Build/Products/Debug-iphonesimulator/SQLite.framework/SQLite' (no such file)
Could someone help me with a solution?