-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Swift High Performance
By :
In the previous step, while playing with xcrun, we discovered that there are two different swift compiler tools: swift and swiftc. If you get help for with the -h command, you will notice that they are both Swift compilers with similar options, but there is a difference.
The swift tool compiles and executes swift code. If you run it without any arguments, it will launch a REPL and give you the ability to evaluate the Swift code.

You can also pass a Swift file that you want to run as a parameter. We can simply create a swift file from the command line:
echo 'print("Hello World")' > main.swift xcrun swift main.swift Hello World
You can also pass additional options, such as -O to enable optimization:
xcrun swift -O main.swift
The swiftc compiler compiles swift code and produces the result, but it doesn't execute it. Depending on the option, you can get a binary file, an assembly, an LLVM IR representation, or something else.
Unlike the swift tool, swiftc has a...
Change the font size
Change margin width
Change background colour