I give a big thanks to the man sitting behind swift-arm.com. He made a tremendous effort to make the Swift setup easier than ever.
Hello guys, In this post, I will talk through on installing Swift environment for programming on Raspberry Pi. The Swift version will be set up is Swift 4.1.1
Ok, No more word, let’s started.
Set it up
First and foremost, plug the cord and remotely connect to the Raspberry from your computer over ssh in the terminal. Just simply use the following command
(The default user is pi, password is raspberry)
Second, We need to update apt-get, use this command
sudo apt-get update
sudo apt-get upgrade
Third, We need some software in place
sudo apt-get install git
sudo apt-get install nano
Ok, Now We’re good to set up Swift. This will be done by the help from author of swift-arm.com
curl -s https://packagecloud.io/install/repositories/swift-arm/debian/script.deb.sh | sudo bash
sudo apt-get install swift-4.1-RPi23-RaspbianStretch
Ok, you’re done. Now, let’s double check again. Use this following command to check the Swift version set up on Raspberry Pi.
When you get the above message, then congratulation!. Swift is ready.
Make Hello world!
Ok, let’s make a simple program to say hello.
Create a swift file to print out “hello world”
echo 'print("hello world!")' > hello.swift
Finally, run it
To continue editing the program and do something exciting, you can open the file hello.swift by nano, vim or whatever. My favorite is nano.
Do you feel excited? Let’s write any simple program in swift and share your experience. If you have any trouble, please feel free to ask here.
Next, I’ll share you guys the most convienience and profressional way to work on a Swift project.
- Swift for Raspberry Pi – http://swift-arm.com/2018/08/02/swift-4-1-2-updated-for-raspberrypi-2-3/