I asked this question here incorrectly:
https://developer.apple.com/forums/thread/651187?page=1#615966022
What I am actually trying to do is use a local .xcFramework as a Resource inside of a Swift Package without having to distribute it with the package..?
Am I supposed to create a binaryTarget as a dependency instead of it being a resource?
Im getting the error: "No such module 'SampleFramework' "
Example:
Say that my SampleFramework has a dependency on sample.xcFramework, how can I add it as a resource to use it in sample.swift
Source
Package file
Structure:
| SamplePackage
| - | Package.swift
| - | README.swift
| - | Sources
| - | - | SamplePackage
| - | - | - | sample.swift
| - | - | - | SampleFramework.xcframework
| - | - | Tests
| - | - | - | LinuxMain.swift
| - | - | - | SampleTexts
| - | - | - | - | sampleTests.swift
https://developer.apple.com/forums/thread/651187?page=1#615966022
What I am actually trying to do is use a local .xcFramework as a Resource inside of a Swift Package without having to distribute it with the package..?
Am I supposed to create a binaryTarget as a dependency instead of it being a resource?
Im getting the error: "No such module 'SampleFramework' "
Example:
Say that my SampleFramework has a dependency on sample.xcFramework, how can I add it as a resource to use it in sample.swift
Source
Code Block language // Sample.swift // MARK: Import the local xcFramework inside of my package import SampleFramework struct Model { var something: SampleFramework.something }
Package file
Code Block swift // swift-tools-version:5.3 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "SamplePackage", platforms: [ .iOS(.v13) ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "SamplePackage", targets: ["SamplePackage"]), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "SamplePackage", resources: [ .process("SampleFramework.xcframework") // I have also tried .copy() ]), .testTarget( name: "SamplePackageTests", dependencies: ["SamplePackage"]) ] )
Structure:
| SamplePackage
| - | Package.swift
| - | README.swift
| - | Sources
| - | - | SamplePackage
| - | - | - | sample.swift
| - | - | - | SampleFramework.xcframework
| - | - | Tests
| - | - | - | LinuxMain.swift
| - | - | - | SampleTexts
| - | - | - | - | sampleTests.swift
I think this could be the same issue we are seeing in https://developer.apple.com/forums/thread/651069