Skip to content

Instantly share code, notes, and snippets.

@scott-lydon
Last active April 3, 2021 19:42
Show Gist options
  • Save scott-lydon/60a2f2e4a30c01bb4123698a76545cef to your computer and use it in GitHub Desktop.
Save scott-lydon/60a2f2e4a30c01bb4123698a76545cef to your computer and use it in GitHub Desktop.
// swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "MyLibrary",
platforms: [
.macOS(.v10_14), .iOS(.v13), .tvOS(.v13)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "MyLibrary",
targets: ["MyLibrary", "SomeRemoteBinaryPackage", "SomeLocalBinaryPackage"])
],
dependencies: [
// Dependencies declare other packages that this package depends on.
],
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 this package depends on.
.target(
name: "MyLibrary",
exclude: ["instructions.md"],
resources: [
.process("text.txt"),
.process("example.png"),
.copy("settings.plist")
]
),
.binaryTarget(
name: "SomeRemoteBinaryPackage",
url: "https://url/to/some/remote/binary/package.zip",
checksum: "The checksum of the XCFramework inside the ZIP archive."
),
.binaryTarget(
name: "SomeLocalBinaryPackage",
path: "path/to/some.xcframework"
)
.testTarget(
name: "MyLibraryTests",
dependencies: ["MyLibrary"]),
]
)
// From https://developer.apple.com/documentation/xcode/creating_a_standalone_swift_package_with_xcode
// All credit and ownership goes to Apple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment