To add a dependency to a binary target in a package.swift
file in Swift, you must:
Declare the dependency in the Package
dependency array using its package name and the minimum version required:
main.swift198 chars9 lines
Add the dependency package as a target dependency to each binary target that needs it:
main.swift135 chars8 lines
The dependencies
parameter of the binaryTarget
method allows specifying an array of target dependencies by using its target name.
If the dependency package also defines binary targets, you can use product(name:)
instead of target(name:)
to declare the dependency using the name of the product generated by the other package.
gistlibby LogSnag