If you've got a Raspberry Pi 3 B+, there are several options for getting Swift to install on your Pi.
Option 1: Raspbian Stretch
buildSwiftOnARM repo on GitHub has a link to a pre-compiled binary.
Download it from the link on buildSwiftOnARM.
The file will land in /home/pi/Downloads/
Untar the file with the following command:
tar zxvf swift-4.1.3-RPi23-...
Swift does work out of the box on Ubuntu but only on Intel devices, so not on ARM. However, Uraimo has made some scripts to easily build the swift compiler on a raspberry with Raspbian.