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
hello
$ swiftc hello.swift
$ ./hello
hello
Tagged .

Similar posts

More by Jim

Want to build a fantastic product using LLMs? I work at Granola where we're building the future IDE for knowledge work. Come and work with us! Read more or get in touch!

This page copyright James Fisher 2017. Content is not associated with my employer. Found an error? Edit this page.