I have XCFramework which i distribute via SPM and Cocoapods.
For the source I pass a link where the zipped binary can be downloaded from.
For example in Package.swift I can kinda check for what kind of platform it will be used:
let tvOSPlatform: Bool#if os(tvOS)tvOSPlatform = true#elsetvOSPlatform = false#endiflet package = Package( name: "MySDK", platforms: [ .iOS(.v13), .tvOS(.v13) ], products: [ .library(name: "MySDK", targets: ["MySDK"]) ], dependencies: [ .package(url: "https://github.com/apple/swift-protobuf.git", .upToNextMajor(from: "1.22.1")) ], targets: [ .binaryTarget( name: "MySDK", url: tvOSPlatform ? "${ARTIFACTORY_STAGE_tvOS_URL}" : "${ARTIFACTORY_STAGE_iOS_URL}", checksum: tvOSPlatform ? "${ARTIFACTORY_STAGE_tvOS_SHA256}" : "${ARTIFACTORY_STAGE_iOS_SHA256}" ) ])
This approach with boolean flag doesnt seem great, but at least Package.swift passes linting and maybe it will work, I haven't tested yet.
Though, I have another issue with the same logic but for distribution via cocoapods in podspec file. In the code snippet below is something what I ideally would like to achieve:
if spec.platform.name == :tvos spec.source = { :http => "${ARTIFACTORY_STAGE_tvOS_URL}", :sha256 => "${ARTIFACTORY_STAGE_tvOS_SHA256}" }else spec.source = { :http => "${ARTIFACTORY_STAGE_iOS_URL}", :sha256 => "${ARTIFACTORY_STAGE_iOS_SHA256}" }end
Basically, I need a way to determine when I would use ios artifact or tvos.Any other ideas of how to distribute a binary for different platforms are welcome! Thank you.