Skip to content
The quickest and easiest way to install and use Swift on your Raspberry Pi.
Branch: master
Clone or download
Latest commit 6d59384 Mar 13, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
Swift 4
docs Update Mar 13, 2019
swift-lite-build update version number to 3.0.3 Mar 7, 2019
vsedit add vsedit utility Mar 9, 2019
CNAME Update Oct 29, 2016 Update Mar 7, 2019

Swift-Lite Raspberry Pi Edition


What is Swift-Lite?

Swift-Lite is a super lean version of Swift built for small arm SBC's like the Raspberry Pi running the Debian based Linux OS Raspbian. Swift-Lite uses meta-tags combined with the pre-build processor to make constructing a multi-file Swift project with Module and Library dependancies simple and easy. Swift Modules can be used in much the same way you would use a Framework or a Library.

Swift-Lite is built from the official repo on It includes Foundation, Dispatch and all the main core libraries of Swift.
Not included are the Swift add-ons such as Package Manager, REPL, LLDB and XCTest.
This results in a greatly reduced download and install size from 140MB/725MB to 44MB/240MB but without reducing or compromising the core functionality of the Swift language.

Swift-Lite Raspberry Pi Edition

Swift-Lite Raspberry Pi Edition is a special Swift-Lite universal install for all Raspberry Pi models running Raspbian Stretch. Swift-Lite RPE includes the GPIO library so you can access and control the RPi GPIO pins without having to install any additional software. Simply add import GPIO to your Swift project file.
Swift-Lite RPE is cross compatible over all Raspberry Pi models. This means that a Swift executable that is built on the Raspberry Pi 3 will work on the Raspberry Pi Zero/A+/2 etc including GPIO support.

Installation and Quick Start Guide

Sample Project, Module and Library files for Swift-Lite


  • Helloworld
  • Flash LED Basic
  • Flash LED using Timers
  • HC-SR04 Ultrasonics Distance Measurement


  • Date - Returns the current date in full style
  • Time - Uses DispatchTime to insert wait time - Usage similar to usleep/sleep
  • Command - Run terminal shell commands

Getting Started with Modules


  • GPIO - Access and control the GPIO pins - Features auto board type detect for all Raspberry Pi's

Using GPIO

Getting Started with Libraries

What is swift-lite-build

swift-lite-build is a build utility that scans the swift project file for module and library dependencies and creates a custom swift build command to build the project. swift-lite-build does this by scanning the included meta tags and import statements in the swift project file.
swift-lite-build can be installed and used on any system or platform that has Swift installed on it.
To use simply type swift-lite-build followed by the project file name.

swift-lite-build helloWorld.swift

The Project File

To use a project file with swift-lite-build add the following meta tags.

// name:helloworld
// type:project
// include:numbers.swift
// include:date.swift

The Module File

To use a module file with swift-lite-build add the following meta tags.

// name:numbers
// type:module

File Location

  • Project files can be located in any directory located in the /home/user/ directory.
  • Module files must be located in a directory named swiftModules. swiftModules can be located in any directory located in the /home/user/ directory.

NOTE: There must only be one "swiftModules" directory.

3rd Party Libraries

swift-lite-build also allows you to auto add pre-built swift libraries such as the GPIO libraries. Swift libraries are added to the default /usr/lib directory and can be used in a project by adding an "import" statement.

import GPIO
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.