Is there a way to turn output the time taken to compile a swift file during an xcode build?
I would like to compile from the command line to trigger the same build xcode does but to include the time taken to compile each file.
You can add…
…to Other Swift Flags in Swift Compiler - Custom Flags section (build settings).
Note: You have to keep same order of these flags.
-Xfrontend says that the next flag should be passed to the frontend. It will not work if you reverse the order.
Then you can get compile times in your build log:
Which is useful when you do want to optimize compile time and also it's good to attach this kind of build log when reporting an issue to Apple Swift guys about slow compile time.
Build time of the whole project. Run following command in terminal…
defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES
…restart Xcode, clean & build and…