-
Install Swift development toolchain: https://swift.org/getting-started/#installing-swift
-
Check install successful by running
swift --version
-
Check Package Manager install
swift build --version
-
Create Command-Line Project
-
Put project aside for now
-
In terminal, cd to project directory
-
Create
Source/
folder and create amain.swift
file -
main.swift
is a ruse to get the package manager to build, put onlyprint("Build Successful")
-
Create
Package.swift
file and add dependencies
import PackageDescription
let package = Package(
name: "TestPackage",
dependencies: [
.Package(url: "../Swift-JsonSerializer", majorVersion: 1),
]
)
-
Run
swift-build
-
Run
swift-build --configuration release
-
Run executable
.build/debug/<#TestPackage#>
// Should seeBuild Successful
-
Completely quit Xcode and any Simulators
-
Start Xcode from command-line utils:
xcrun launch-with-toolchain /Library/Developer/Toolchains/swift-latest.xctoolchain
-
Navigate to Project Settings
-
In Import Paths add:
$(SRCROOT)/.build/debug
$(SRCROOT)/.build/release
- Go to the
main.swift
in Xcode project - Import library
// TODO:
I'm pretty sure that main.swift
could be the same file