iOS Simulator is an integral part of any iOS development process. We just can’t ignore it. New Simulator from Xcode 9 brings a lot of useful tricks, which could make you even more productive. Finally, Apple recalled they have Simulator out there! Comparing to previous modest updates, this one seems like a big deal. 🙌

So let’s break this down and list all features I found in new iOS simulator (some tricks you can use in the old Simulators as well).

#1 Use Simulator in full-screen mode with Xcode

When you have 13" screen the full-screen mode for Xcode is a just life saver. Unfortunately, you couldn’t use Simulator with Xcode in the full-screen mode previously. Well now you can 😎

Full-screen mode with Xcode 9 and iOS Simulator

This feature is enabled by default starting from Xcode 9b3. So you don’t even need to do anything to make it work.

UPD: It turned out this feature is disabled by default for some people, but don’t worry, you can always enable it via Apple Internal menu as I described further.

If you want to explore more secret features in new Simulator you should enable Apple hidden Internals menu.

To do so you need to create an empty folder with name “AppleInternal” in the root directory. Just run this command below and restart Simulator:

sudo mkdir /AppleInternal

The new menu item should show up. ☝️

Note:

I’ve tested this approach on Simulator from Xcode 9b3. If you don’t have it, please download latest Xcode here.

#2 Open multiple Simulators at once

Do you remember the frustration of testing your app on different simulators? Previously you were forced to open only one Simulator instance at the time. There were many “hacks” how to open multiple instances of iOS simulator in an older version of Xcode. But finally, with Xcode 9 this feature is available out of the box.

#3 Resize Simulator just like a regular window

Before Xcode 9 we had “Scale options” only to adjust simulator’s window size. Now Apple finally made resizing of the Simulator’s window available. It’s useful little detail which can help you organize workspace efficiently if you have multiple simulators opened.

#4 Record video of Simulator

In the official “What’s new” document for Xcode 9, Apple claims that now you can record a video of simulator’s screen. It’s not completely true. You can do it even in the older versions with simctl . I didn’t find any evidence you can enable video recording from the interface though (except for built-in screen recording in iOS 11).

For getting your video file, execute the following command:

xcrun simctl io booted recordVideo --type=mp4 <PATH TO VIDEO FILE>

booted — means, that simctl selects currently booted Simulator. In case you have more than one booted Simulator, simctl selects currently active instance.

#5 Share files to Simulator right from Finder

Now Simulator has Finder extension which allows you to share files directly from the Finder’s window.

You can do something similar with image/video files using the simctl command below:

xcrun simctl addmedia booted <PATH TO MEDIA FILE>

It’s nice to have such abilities. However, drag&drop file to the Simulator’s window seems much faster for me.

#6 Open URLs on Simulator

This one comes with simctl as well. So you can open custom URL schemes on older Simulators too.

Execute the command below with whatever URL you need:

xcrun simctl openurl booted <URL>

For the list of all Apple’s URL schemes please check out documentation.

#7 Quickly find app’s container folder

One more command from simctl . You can get app’s container on the file system with a single command. You just need to know app’s bundle identifier and execute the command below:

xcrun simctl get_app_container booted <APP'S BUNDLE ID>

Or you can make it even faster by opening destination folder in Finder with the open command:

open `xcrun simctl get_app_container booted <APP'S BUNDLE ID>` -a Finder

#8 Launch your app in Simulator with command line args

With simctl you can also launch your app from terminal and pass some command line arguments there (you can even setup some environment variables). It can be helpful if you want to add some hidden debug-only behaviour to your app.

The command below help you with that:

xcrun simctl launch --console booted <BUNDLE ID> <YOUR ARGUMENTS>

You can get these command line arguments from CommandLine.arguments (here is the link to documentation).

#9 Get full application info with Bundle ID

Sometimes it’s useful to find out where your app file or temporary data located on the file system. If you need more comprehensive information than simctl get_app_container can give. simctl also has this nice little tool called appinfo which will show you some information in the following format:

{

ApplicationType = User;

Bundle = <PATH TO APP FILE>;

BundleContainer = <PATH TO FOLDER WITH APP FILE>;

CFBundleDisplayName = TestiOSApp;

CFBundleExecutable = TestiOSApp;

CFBundleIdentifier = "com.ahmed.app.TestiOSApp";

CFBundleName = TestiOSApp;

CFBundleVersion = 1;

DataContainer = <PATH TO YOUR DATA>;

GroupContainers = {

};

Path = <PATH TO APP FILE>;

SBAppTags = (

);

}

Execute command below and explore the output:

xcrun simctl appinfo booted <BUNDLE ID>

One last thing…

iOS Simulator is a very powerful tool which can speed up your development process a lot. But only if you know all little details and tricks. And obviously, as a good engineer, you have to know your tools.

Here at Flawless, iOS Simulator is extremely important for us. Our product is an iOS Simulator plugin which allows engineers to inspect any design on top of implementation right inside Simulator. So I can’t even tell you how happy I’m with this new Xcode 9 and Simulator release. Can’t wait for the public version! So we can implement more useful features to keep a visual quality of iOS apps in a good shape.

Also, if I missed something important feel free to add your tricks in the comments below. I believe it will be really useful to have more tricks in a single place 😊