Skip to main content

Swift Commands

Create a package #

$ swift package init --name <Package Name>

To create an executable package

$ swift package init --type executable

To create a library package

$ swift package init --type library

To create a macro package

$ swift package init --type macro

Update package dependencies after modifying Package.swift #

$ swift package update

Clean build artifacts #

$ swift package clean

$ swift package clean=dist //clean build and dependency

Build #

$ swift build

$ swift build -c release

Run package test cases #

$ swift test

Run package #

$ swift run <optional executable and arguments>

Start REPL for interactive experiment #

$ swift repl