While working on [yesterday's post][yesterday], I noticed that Xcode uses the
swift command to perform its compiles rather than the swiftc command. What's odd, and maybe some others know more information here, is that swiftc is just a link to swift.
$ xcrun -f swift
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
$ xcrun -f swiftc
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc
$ xcrun -f swift | ls -l swift*
-rwxr-xr-x 1 root wheel 35546880 Nov 17 10:16 swift
-rwxr-xr-x 1 root wheel 505488 Nov 17 10:16 swift-demangle
-rwxr-xr-x 1 root wheel 46832 Nov 17 10:16 swift-stdlib-tool
lrwxr-xr-x 1 root wheel 5 Nov 18 12:38 swiftc -> swift
However, it seems the swift tool itself is detecting how it's actually being run and switching modes internally.
This is obvious if you just run the two:
swift– opens the Swift interpreterswiftc– prints an error<unknown>:0: error: no input files
So why am I bringing this up? Well, I found it interesting. =) In the end, I believe that swiftc is virtually the same as swift -frontend -c; however, I've not been able to confirm that fully and the error messages are slightly different between swiftc and swift -frontend -c, so the code path has to be at least a little different.