Make environment for Swift Practice
I need to learn swift again, and of course XCode project is one of option to use Swift practice. But, I want to use simple env just try swift programming
I have some options to set up Swift Practice Env
- Commandline and Text editor
- Linux Docker with REPL
Playground is simple way to test swift program
This is XCode tool.
Commandline and Text editor
Create file and compile and run
import Foundation print("Hello")
Compile codes (with swiftc command)
Run execution file
If you want to run without compile
This is dialog base programming environment like Iron Python
To start REPL
Welcome to Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-118.104.22.168).
Type :help for assistance.
Linux Docker with REPL
We can create isolated environment with Linux docker.
Swift supports Linux(Ubuntu), too. Docker image is provided by many people
This is an example (swift-docker)
docker pull swift docker run --security-opt seccomp=unconfined -it swift
You can use swift REPL on linux