Getting Started with Apple Watch Development

Xcode Simulator

Your browser needs to be JavaScript capable to view this video

Try reloading this page, or reviewing your browser settings

This video segment demonstrates test cases in the Xcode simulator to check the display and functionality of your app on various iPhone and Apple Watch models.


  • simulator
  • xcode
  • watchkit
  • Apple Watch

About this video

Ravin Sardal
First online
06 April 2019
Online ISBN
Copyright information
© Ravin Sardal 2019

Video Transcript

In this video, I’m going to demonstrate how to run and use the Xcode Simulator. So let’s open up Xcode. And I’m going to create a new project. You can use an existing project if you’ve already created one, but I’ll just start from scratch. And let me just call this Test App 2. I’m going to uncheck notifications seen, because that might be a little confusing when running the simulator.

And it should create my project. OK. So as you can see, Xcode opened up our familiar interface. But one thing I didn’t mention in the earlier videos, because I wanted to save it for now, is how we can actually run, build, and stop an application. So over here, this sideways triangle, this Play button is actually– builds the app. Which means takes all the code, it builds it, and then runs it to whatever scheme that we specify.

So in this case, the scheme is Test App 2, and that’s for the iOS app. But underneath, we have the scheme for a WatchKit app. And what it does is it opens up both the iOS simulator, and the watchOS simulator. So let me just check Test App 2 to WatchKit app. Over here, you’ll see the options to choose what simulator you want. You can pick your own personal device, or you can use these simulators that actually pop up on the screen.

And you can choose to add any additional simulators, or download simulators in case you want to test on an older operating system version, or a different screen size, or a different Apple Watch size. I know there are like four different sizes now. So yeah. So I’m just going to click the iPhone XS macs, and the Series 4 Apple Watch, for are targeted simulator.

And just hit the Run button. And what Xcode’s going to do is it’s just going to build everything, build all the tasks, and load them up onto the simulator. And there is actually the simulator is independent of the Xcode application. If you look in your dock, you’ll see the Xcode application. What Xcode does is it launches a separate application which is for the iOS simulator.

And don’t worry, you don’t have to download that application. It actually comes in bundled with Xcode. So yeah, let me just minimize Xcode. Or actually, I’ll just move it to the side. And we can see that our simulator has popped up. So the simulator comes in with all the familiar buttons, and interfaces that you see on the Apple Watch.

You can use the scroll wheel for the Apple Watch here. You can use the Sleep, Wake, or sorry, the Multitasking button right here. And it also comes in with like a full-blown iOS simulator. So this is actually an iOS phone. But it’s running on your computer. And the nice thing about these simulators is they provide really cool functionality for testing.

So for example, if you have an application that you want to test while it’s in a car, and you want to simulate location, what you can do is when the simulator is selected on the screen, you can actually go to the simulator file menu over here in the top left hand corner, and you can go to debug. And it gives you a few options.

You can choose to be at the Apple, simulate the location at the Apple headquarters. You can choose to go for a freeway drive, a city bicycle ride. And let’s say your Apple Watch application is a running app where you want to track a user running around the city, and measure their heartbeat, or steps. You can simulate a city run.

So this is really helpful when you want to debug, and you actually can’t go into the real world and test it. So it’s pretty awesome that they’re providing you with all these features. And these are actually clickable buttons over here. So if you’ve used an Apple Watch for, this interface will be familiar. You can swipe between the watch faces. So if you want to have complication scenes, you can also simulate those, and see how those look.

But we’ll just open our test app here. Oh, it’s one of these. There we go. Test App 2. And right now, it’s a blank screen, because we haven’t written any code. And I just opened it up. But we can see that over here, there is a parallel Test App on the iOS side. And what’s the neat is that if you have any communication between the Apple Watch and the iPhone, which in many cases, the Apple Watch does need to pull data from the iPhone.

And then go back and forth, we can do that in the simulator, because it opens up both devices. But yeah, that’s pretty much it. It’s really simple to run the simulator. Again, you just have to select your scheme over here. Let me just make it bigger.

You have to select your scheme over here. You can choose to run it just for the iOS target, or the watchOS target. And you can select which device, and all you have to do is hit the Run button. And it re-loads your code, and runs it on the simulator. And you have to click Run every time you execute new code.