swift-bridge icon indicating copy to clipboard operation
swift-bridge copied to clipboard

Add support for specifing platforms in Package creation

Open gemcoder21 opened this issue 2 years ago • 1 comments

Current Package.swift format

import PackageDescription
let package = Package(
	name: "WalletChainCore",
	products: [
		.library(
			name: "WalletChainCore",
			targets: ["WalletChainCore"]),
	],
	dependencies: [],
	targets: [
		.binaryTarget(
			name: "RustXcframework",
			path: "RustXcframework.xcframework"
		),
		.target(
			name: "WalletChainCore",
			dependencies: ["RustXcframework"])
	]
)

If you are using any async method, you are required to specify at least iOS 13 version to use it:

platforms: [.iOS(.v13)],

Expected:

import PackageDescription
let package = Package(
	name: "WalletChainCore",
        platforms: [.iOS(.v13)],
	products: [
		.library(
			name: "WalletChainCore",
			targets: ["WalletChainCore"]),
	],
	dependencies: [],
	targets: [
		.binaryTarget(
			name: "RustXcframework",
			path: "RustXcframework.xcframework"
		),
		.target(
			name: "WalletChainCore",
			dependencies: ["RustXcframework"])
	]
)

gemcoder21 avatar Feb 12 '23 04:02 gemcoder21

Thanks for opening this issue and for including the Expected section.

Would something like this work for you swift-bridge-cli create-package --platforms iOS=13.1 --platforms macOS=12.3?

Along with a change to swift-bridge-build::create_package to let you specify a list of platform requirements?

chinedufn avatar Feb 13 '23 23:02 chinedufn