Skip to content

compiled

Blake Merryman edited this page Jan 29, 2015 · 1 revision

Running Compiled Binaries

It is also possible to manually compile swift files. To do this, we use the swiftc command:

$ cd /path/to/program/
$ swiftc myprogram.swift

This will create an executable binary of the same name (here it would be myprogram) in the same directory.

Other Options

  • Specify a custom executable name:

    $ swiftc myprogram.swift -o anothername
  • Compile multiple source files together into one executable:

    $ swiftc main.swift constants.swift helperfuncs.swift -o myexecutable

    Note:
    If compiling multiple files into one executable, you will need a main.swift file so that your program will have an insertion point. It may be best to use Xcode while working with a larger project as you will gain multiple advantages (specifically Code Completion).

Clone this wiki locally