During WWDC 2018 Apple announced Xcode 10 with a lot of new features. Many of them are available for you automatically and enabled by default, but some of them might not show up and need some manual adjustments.
To enable it, open preferences under
Text Editing > Editing and select
Code folding ribbon.
Where in other years many of us might have used
Whole Module compilation mode to improve our builds times. As Apple blogged and told us:
Whole-module optimization is an Optimization Mode of the Swift compiler. The performance win of whole-module optimization heavily depends on the project, but it can be up to two or even five times.
This year, we’re advised to implicitly not use the
Whole Module compilation mode, but instead use
Incremental for better results. This should be enabled by default in Xcode 10, but you might want to verify this in your project.
As Apple mentioned in the “What’s new in Swift” session:
Using Whole Module for Debug builds was a stopgap to improve builds. Whole Module prevents incremental builds.
Defining the right optimization level
Available since Swift 4.1, there is a new optimization mode available which enables dedicated optimizations to reduce code size. More in-depth details can be read on the Swift blog post Code Size Optimization Mode in Swift 4.1.
Improve testing performance
Xcode 10 introduces a lot of improvements related to testing performances. Both unit and UI tests can finish a lot faster than they used to do.
By opening your testing scheme settings you can enable three new options:
Execute in parallel on Simulator. This will run your UI and unit tests in parallel on multiple simulators and speeds up your tests drastically.
Randomize execution order. This is a commonly used technique to verify that your tests aren’t dependent on each other, or in other words, avoid biased testing.
Automatically include new tests. If you’re testing a subset of your test bundle and you don’t want to automatically add new tests, you can disable this option which is enabled by default.
Replacing // TODO: with the new #warning
You might have added a custom run script to show warnings for
// TODO: like explained in several blog posts. Just like before in Objective-C, we can now replace those by simple
#warning statements pointing out we need to update that piece of code.
WWDC brings a lot of updates on all the work done by Apple in the past year. Make sure to check out the sessions here.