Script Snippet: Swift Packages

From Coder Merlin™

Create a new Swift Package for an Executable

swift package init --type executable

Remove the build artifacts of a Swift Package

swift package reset

Build a Swift Package in default debug mode

swift build

Build a Swift Package for debugging in lldb

swift build -Xswiftc -g

Build a Swift Package in release mode

swift build

Create a Library

swift build -Xswiftc -emit-library

Consume a Library

swift build -Xswiftc -I -Xswiftc ./.build/debug -Xswiftc -L -Xswiftc ./.build/debug -Xswiftc -lmyDynamicLib

Reference