Difference between revisions of "Script Snippet: Swift Packages"

From Coder Merlin
(Created page with "== Create a new Swift Package for an Executable == swift package init --type executable")
 
(Undo revision 2997 by Merlin (talk))
Tag: Undo
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Create a new Swift Package for an Executable ==
== Create a new Swift Package for an Executable ==
<syntaxhighlight lang="bash">
swift package init --type executable
</syntaxhighlight>
== Remove the build artifacts of a Swift Package ==
<syntaxhighlight lang="bash">
swift package reset
</syntaxhighlight>
== Build a Swift Package in default debug mode ==
<syntaxhighlight lang="bash">
swift build
</syntaxhighlight>
== Build a Swift Package for debugging in lldb ==
<syntaxhighlight lang="bash">
swift build -Xswiftc -g
</syntaxhighlight>
== Build a Swift Package in release mode ==
<syntaxhighlight lang="bash">
swift build
</syntaxhighlight>
== Create a Library ==
<syntaxhighlight lang="bash">
swift build -Xswiftc -emit-library
</syntaxhighlight>
== Consume a Library ==
<syntaxhighlight lang="bash">
swift build -Xswiftc -I -Xswiftc ./.build/debug -Xswiftc -L -Xswiftc ./.build/debug -Xswiftc -lmyDynamicLib
</syntaxhighlight>


swift package init --type executable
[https://theswiftdev.com/2019/01/14/all-about-the-swift-package-manager-and-the-swift-toolchain/ Reference]

Latest revision as of 13:36, 1 July 2019

Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Create a new Swift Package for an Executable[edit]

swift package init --type executable

Remove the build artifacts of a Swift Package[edit]

swift package reset

Build a Swift Package in default debug mode[edit]

swift build

Build a Swift Package for debugging in lldb[edit]

swift build -Xswiftc -g

Build a Swift Package in release mode[edit]

swift build

Create a Library[edit]

swift build -Xswiftc -emit-library

Consume a Library[edit]

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

Reference