A swift script that builds your Swift project on a remote machine.
For example, let's say you want to write some swift code on your raspberry pi, with this script you can write your code in Xcode and use this script to sync your project to your raspberry pi! This project was inspired by the Swish script.
- Swift installed on your Raspberry Pi. For more details on how to install swift on Raspberry PI, check out this blog post.
- SSH Key Pair. See below for setup.
In order for this script to work properly, you need to setup your SSH authentication between your mac and your remote machine. How do you know if this is already setup? Perform the following steps:
- Launch your terminal and enter the following
ssh <username>@<hostname>
. - If you were able to connect without entering a password, you are ready to proceed!
- If you were prompted to enter a password, you will need to go through the process of setting up
Passwordless SSH Access
. We need to do this because when we are executing this script via Xcode, there is no means to respond to a prompt while the script is executing. This article walks through the process of setting up the connection between your mac and remote machine.
Installation with Mint
$ mint install digimarktech/Xport
Once you have installed Xport
, it can be used to transfer the code you have written in Xcode to your remote machine or Raspberry Pi. Below are the steps necessary to get everything working.
- Create
External Build System
.
-
Add your
swift pacakage
. This is the code that you have written to execute on the raspberry pi. If you have already created a package locally, you can simply drag it in. Otherwise, you can import it via its hosted github URL or create a new package altogether. -
Provide the values for your
External Build Tool Configuration
. Here are the fields:
- Build Tool: This is the path where
Xport
was installed. If you used Mint to install it, you can use the following path/usr/local/bin/xport
- Arguments: These are the arguments used by the
Xport
script to execute it. The first argument represents theusername
used on your Raspberry Pi. The default username ispi
. The second argument is thehostname
orip-address
used to connect to your pi. - Directory: Here is where you specify the path of the swift package that you are copying over.
CMD + B
to build and execute the script. If you want to see a log of the script use theReport Navigator
tab in Xcode.
Marc Aupont, @digimarktech
Xport is available under the MIT license. See the LICENSE file for more info.