How to run Swift from the CLI

So far I’ve only had experience of running Swift from Xcode as part of a project. But you can also run and compile Swift independently of Xcode. Example:

$ echo 'print("hello")' > hello.swift
$ swift hello.swift
$ swiftc hello.swift
$ ./hello

Get updates on Twitter

I wrote this because I felt like it. This post is not associated with my employer. This site is hosted by Netlify (who are great, but I'm not associated with them either).