Is Swift compiled or interpreted?

Swift is compiled ahead of time to machine code through the LLVM compiler backend. It has no virtual machine and no tracing garbage collector.

How it runs your code

The Swift compiler, swiftc, turns your source into machine code before the program runs. Memory is managed by automatic reference counting, which frees objects when their last reference goes away. Swift can run scripts and a REPL, but production Swift is compiled.

Does that make Swift slow?

Swift's optimizer works before the program runs, and you choose between an unoptimized debug build and an optimized release build. Always time a release build.

Questions

Is Swift interpreted?

No. Swift is compiled ahead of time to machine code, even though it offers a REPL and scripts for convenience.

Does Swift have a garbage collector?

No. Swift uses automatic reference counting.

What compiler does Swift use?

swiftc, which uses LLVM to produce machine code.

Related

Is Rust compiled? · Is C++ compiled? · Is Go compiled? · Compiled vs interpreted · Why optimization decides speed