Give your simulator superpowers

RocketSim: An Essential Developer Tool
as recommended by Apple

Enabling newly added opt-in features in Xcode 10

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.

Code folding

To enable it, open preferences under Text Editing > Editing and select Code folding ribbon.

Xcode 10 Code Folding

Xcode 10 Code Folding

Incremental Builds

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.

Xcode 10 Incremental Builds

Xcode 10 Incremental Builds

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.

Stay updated with the best of Swift & SwiftUI

Join over 20,003 Swift developers in SwiftLee Weekly for exclusive tips and updates. Don’t miss out – subscribe now:

You can always unsubscribe, no hard feelings.

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.
Xcode 10 Testing Options

Xcode 10 Testing Options

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.

Xcode 10 Warnings

Xcode 10 Warnings

Other updates

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.

 
Antoine van der Lee

Written by

Antoine van der Lee

iOS Developer since 2010, former Staff iOS Engineer at WeTransfer and currently full-time Indie Developer & Founder at SwiftLee. Writing a new blog post every week related to Swift, iOS and Xcode. Regular speaker and workshop host.

Are you ready to

Turn your side projects into independence?

Learn my proven steps to transform your passion into profit.