For some reason when I try to run swift build
on my Package.swift
file:import PackageDescription
let package = Package(
name: "mobile-HDISegurado-ios",
dependencies: [
.package(url: "https://github.com/watson-developer-cloud/swift-sdk", from: "0.30.0"),
],
targets: [
.target(
name: "mobile-HDISegurado-ios",
dependencies: ["WatsonDeveloperCloud"],
path: "mobile-HDISegurado-ios",
exclude: [
"Config",
"Public",
"Resources",
]
)
] )
I've got the following error:
error: target at '.../mobile-HDISegurado-ios' contains mixed language source files; feature not supported
More details:
SPM now supports mixed language source files, but you may have to separate them into multiple targets.
From the relevant docs:
Targets can contain Swift, Objective-C/C++, or C/C++ code, but an individual target can’t mix Swift with C-family languages. For example, a Swift package can have two targets, one that contains Objective-C, Objective-C++, and C code, and a second one that contains Swift code.
In practice, you should move your ObjC/C/C++ files into one directory, move your Swift files into another directory, and then modify your Package.swift thus:
products: [
.library(
name: "MyLibrary",
targets: ["MyLibrarySwift", "MyLibraryObjC"]),
],
.target(name: "MyLibraryObjC",
path: "Sources/MyLibraryObjC"
),
.target(name: "MyLibrarySwift",
path: "Sources/MyLibrarySwift"
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With