Check out example codes for "how to install swift on ubuntu". It will help you in understanding the concepts better.

Code Example 1

sudo apt-get update
sudo apt-get -y install curl libcurl4 libcurl4-openssl-dev clang libicu-dev
mkdir ~/.swiftenv
git clone https://github.com/kylef/swiftenv ~/.swiftenv
echo 'export SWIFTENV_ROOT="$HOME/.swiftenv"' >> ~/.bashrc
echo 'export PATH="$SWIFTENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(swiftenv init -)"' >> ~/.bashrc
source ~/.bashrc
swiftenv install https://swift.org/builds/swift-5.0.2-release/ubuntu1804/swift-5.0.2-RELEASE/swift-5.0.2-RELEASE-ubuntu18.04.tar.gz
swift --version

Learn ReactJs, React Native from akashmittal.com