[ Background Sounds ]
Thank you all for coming.
My name is Ian Parks.
[Applause] Thank you.
[ Applause ]
My name is Ian Parks and I work on the watchOS software team.
I'm really excited to tell you what's new in watchOS 4 and what that's going to mean for you as developers so you can continue to deliver fantastic apps on watchOS.
It's only been two years since we first released Apple Watch and the platform has come a long way.
We're continuing to learn from our users and how Apple Watch is continuing to make a difference in their lives.
And this year we're adding a ton of new features in watchOS 4.
Like a brand new news app that lets you browse headlines and mark the ones you'd like to read later.
And a totally redesigned music experience that lets you sync multiple playlists and it has a new interface that's both fun and easy to use.
We were also trying to make workflows more efficient for users like being able to access to the now playing UI right from inside of a workout as well as surfacing important information throughout your day in a new Siri watch face.
And of course, we're introducing a ton of new features for developer so you can continue to create great watchOS apps.
Now last year we introduced three guiding principles for how to create great Watch experiences.
And we're continuing to pursue these in our system apps as well as how we're creating frameworks for you.
Let's take a moment to look back at these and see how they're continuing to drive interactions in watchOS.
The first is making our app glanceable.
Interactions on Apple Watch are very short.
And the screen size is much smaller than on other platforms.
So we need to carefully consider what information to present on the UI and make sure that it's well designed information so the user can quickly absorb and respond to the information.
And the second is making the information actionable.
And what we mean by this is bringing pieces that the user can respond to either within the application like changing a music track or sometimes in their current surroundings.
A quick glance at weather conditions, for example, can tell me whether or not I need to pick up an umbrella on my way out the door but actionable information can also come in the form of audio too.
For instance, I can get in ear coaching during a workout to tell me when I've fallen behind my pace.
And finally responsive.
While performance is a really crucial metric for watchOS apps, we mean a bit more when we say responsive here.
This also means making sure that your content remains up-to-date always.
And it also takes into consideration what the user might want to do next in your application.
Let's take a look at a few examples of how these are manifesting themselves in watchOS 4.
So last year, we introduced the Quick Start workout feature which let you start the workout that you most commonly do very quickly.
The idea being that you're most commonly going to use the same workout over and over.
So we let use the same goal that you've set previously to get started in just a few seconds but if you do a rotating set of workouts like do you do a run one day?
And you do a swim the next day and the bicycle ride the day after that?
First of all, congratulations because you're getting a lot of exercise.
But also you're going to have an extra step every time of setting a goal.
So in watchOS 4, we've made this a lot easier.
Every workout will track the previous goal that you've set for that workout type and if you haven't set one, with defaults to an open goal.
And that means that every workout type is a Quick Start workout.
This is a great example of making the most common action that the user's going to take the easiest one for them.
It lets them glance at the UI and get started very quickly.
And while you're inside of a workout, you can now add a second workout into your routine.
For example, if I wanted to start with a high intensity interval training and finish with a quick run.
This used to be a multistep process where I would have to finish my workout.
Then save it.
Then return to the list of workouts.
I would find the next one that I'm going to do which is probably not going to be a Quick Start workout at that point.
So I'm going to have to set a goal and then continue.
Now it's just a quick tap to add the second workout and another to Quick Start it.
This is a great example of building a responsive user experience where it's not just about updating the data in your UI.
It's also about thinking about what the user might want to do next in your app based on what you already know.
Now the dock is a great place to showcase glanceable information from your app.
And as you saw in the keynote, we've transitioned the dock from being a horizontally scrolled to being vertically scrolled.
As you'll see in one of the UI updates in WatchKit shortly, apps should consider what kind of navigation feels most natural for your app and transition accordingly.
So that it's really easy to navigate your app either with swipes or by scrolling through information.
In addition to transitioning to a vertical orientation, the dock also now has two modes of operation.
There's favorites mode and recents mode.
Favorites mode will be familiar.
It operates just like the dock does in watchOS 3 where a user can pick specific apps and the order in which they'd like them to appear in the dock as well as one most recently used slot for the last app that they've used.
Recents mode will look just like the app switcher on iOS.
Apps will transition in and out of the dock as you use them throughout the day.
And that means that you're more likely to see your app show up at some point during the day in the user's dock.
And that means that it's even more important to make sure that you're updating snapshots using the background snapshot API we introduced last year in watchOS 3.
We're also making enhancements to this API.
For example, you can now get a callback for when you get a snapshot test to tell whether or not it's a snapshot that you have scheduled or one that's being automatically provided to you but that's triggered by the system.
Also remember that apps that either in complications or in the dock are launched in the background and suspended but kept in memory.
So opening them is really fast.
Now for the rest of our time here today, we're going to talk about three topics that we focused on this year in the WatchSTK.
The first of them is UI flexibility.
Giving you more options to present information and actions to users.
The second is performance.
So apps always feel as responsive as possible.
And finally background processing so the users can engage in activities beyond the foreground app experience whether it's in the dock in a complication or in an ongoing task like a workout.
First let's take a look at UI flexibility.
Now WatchKit provides a focused set of UI components that have been optimized for the Watch screen.
But we want to make sure that those are flexible enough for you to create custom user interfaces that meet the personality of your app.
Now if you've already created a Watch app or you're new to developing on the platform, you're going to love how easy it is to take advantage of the new UI capabilities in watchOS 4.
And if you're a parent, I'm going to show you how to get workout credit for the things you're probably already doing around the house.
More on that in just a second.
Now I have a 4-year-old and 1-year-old at home.
And often times between work and wrangling the kids, I don't find time during the day to do a formal workout but honestly, a lot of what I find myself doing feels an awful lot like a workout whether it's piggyback rides or cleaning up toys.
So I created a new app that lets me track these more non-traditional workouts.
And we're going to use this as an example to see some of the new UI capabilities in watchOS 4.
So here we have a simple in-workout interface.
It's showing me the calorie counter in the middle as well as a time label and a SpriteKit scene of a child being chased by their parents around the screen.
This is the kind of interface that's really hard to do in watchOS because you can't overlap interface elements.
So let's take a look at what's going on here.
So here we have a group in front containing the labels that I mentioned.
And that's on top of a SpriteKit scene.
Now I know you're thinking I just said you can't overlap interface elements.
In watchOS 4, we've created a new group layout that allows you to do things like this.
Let's take a look at interface builder to see how you can use that.
So a new option has been added to groups.
So in addition to vertical and horizontal layouts, you can now select overlap.
And when selected, overlap groups do not compute offsets for each individual element.
Instead, you can select their individual alignments like top, center, and bottom or left, center, and right, and the elements are laid out according to those in a more absolute fashion within the group.
And you can also nest groups within each other like I've done here with the metrics group, which contains my labels inside of a vertical group.
And you can also use [inaudible] and spacing in order to fine tune placement within the groups.
You can also specify z order by the order in which the elements appear in the outline view as seen here.
This is going to make a huge difference in making it easier to create custom user interfaces.
Now in my workout control screen that you'll see here in a second, I've now added a water lock button.
And water lock can be really helpful for rejecting false touches from water being on the screen.
Or in my case because my daughter's usually trying to eat my watch [laughter] but previously in workout apps for third parties, for a user to engage water lock you'd have to start the workout, go back out to the Watch face, swipe up to reveal control center, and then enable water lock.
Then the next time that you raised your wrist, the workout app would be on the screen.
We're going to make that a lot easier in watchOS 4 and now you can include a button within your own user interface so that it fits the personality of your app.
Now water lock can only be enabled by developers, never disabled.
The user has to do that themselves.
When they try to interact with the side button or digital crown, an overlay will appear just like the one seen here.
It's the same one that's used by the system currently.
And it tells them how to disable water lock.
Water lock can be enabled in workout as well as in one other session based activity that we'll get to in a little bit in the presentation.
And the reason for this is because apps that are not in a workout session, after a period of time and when the wrist has been dropped, the app will be suspended in the background.
So when the user raises their wrist, they won't see the app anymore and the screen is locked so they can't open it back up but with a workout app, the app will always appear every time they raise their wrist.
So I can see up-to-date information in from my workout as I'm going through it even though the screen is locked.
Let's take a look at how to enable this in code.
As you can see, it's pretty simple to enable.
It's a single call on the shared extension object.
Now one last thing to note is that water lock can only be enabled while the app is in the foreground.
So the user is always aware of what's going on.
Now here you can see my app is giving me a congratulatory fist bump for figuring out a way to fit in a workout into my parenting responsibilities.
Now this might be something that I'd like to show someone else but my options are kind of limited on watchOS.
I can either do this awkward gesture where I try and keep the screen on while I turn it away from myself or I can turn it over and tap on the screen but the content is upside down.
In watchOS 4, we're giving you the ability to turn on auto rotate.
When enabled, wrist movement will not turn off the screen.
And we automatically rotate the content when your wrist is turned away from you.
This will not keep the screen on indefinitely.
The idle timer will still sleep the display after a period of inactivity but you should have plenty of time to show the content on your watch to someone else.
Let's take a look at the property.
You're going to start to see a bit of a theme here.
You don't have to do a lot of work to take advantage of a lot of the UI capabilities that we're adding in watchOS 4.
There's a lot of applications of this.
So let's take a look at a few examples.
Proloquo4Text is a text based communication app that gives literate children, teens, and adults the ability to speak without voice.
The app allows them to tap on preprogrammed personal phrases and turn their wrist towards another person to communicate with a text on their wrist.
Here I can place my coffee order by showing my wrist to the cashier and having the text remain on screen and upright when I turn it away from myself.
I can even pay for my order using the Starbucks app.
Starbucks lets me open my barcode from my personal card and have that shown on screen.
Then I can show that to the scanner at the cashier and have it remain on screen so that it can read it.
There's a ton of different applications of this.
So you should consider what content in your application might be applicable.
In our next step, we have a new style for paging views, a vertical paging view.
I could have implemented this as a scroll view but really these are two distinct pages.
And it's great how they just snap into place.
It's also really natural to use with the digital crown.
And the animation between the pages is very similar to the one we introduced last year for performing segues between table rows in a master detail application but now you can do so without using a navigation controller.
Let's take a look at how you implement this interface.
So we replaced the reload root controller's method with a new one that takes in two key pieces of new information.
The first is the ability to set the orientation.
So you use the same method whether you're doing it in a horizontal paging view or a vertical paging view.
And the second one is something that we've heard a lot of feedback about and we're excited to be able to offer in watchOS 4.
And that's the ability to set the initial page index.
So this is great for things like workout apps where you want a main workout UI.
[Applause] I know we've seen lots of radars.
And you want the control screen left to center but you want to load directly into the main workout UI.
So this allows you to set the index to wherever you want and have it load directly there.
Now here we have a history view.
And when doing an interface like this where we may have hundreds of records, there's a couple of things to keep in mind.
The first is storage.
I probably don't want to store all of my workouts that I've ever completed on the watch when I can easily load them using watch connectivity from the phone or from a server.
The second is performance.
Loading too many table rows at once can lead load lead to a decrease in performance and load time for the table.
So here we're now allowing you to get callbacks for when the user scrolls to the bottom of the screen or the top of the screen.
So you can do things like I have here where I'm getting the callback.
I'm loading putting on a loading indicator and then I'm loading data from the phone.
Let's take a look at how you can implement these callbacks.
So the first one is the one I was just using in the last user interface.
This gets called when the animation completes, when the user scrolls all the way to the bottom of the screen.
The second is the exact opposite, interfaceOffsetDidScrollToTop which gets called when you scroll to the top of the screen.
And the last one, interfaceDidScrollToTop gets called when the user taps on the status bar, which scrolls the interface all the way to the top.
Now we've also included in a scroll function, which lets you pass in an interface element and have it scrolls to appear at either the top, center, or bottom of the screen.
I use that in my history view to show loading indicator.
When I loaded the group that contained my animation, it loaded off screen.
So I passed it into the scroll method and set it to show at the bottom of the screen.
And here we have a reimagined post workout screen that's been redesigned as a full screen animation.
In watchOS 4 for SpriteKit and SyncIt [phonetic] apps, you can now make use of the entire display.
It is still a watch though, so we are always going to display the time in the top corner with a gradient behind it so the user can always read the display regardless of the color of content behind it.
As you can see, there's a lot of new changes in creating your user interfaces in watchOS 4.
I encourage you to check out a session later this week on planning a great Watch experience, which will be going through planning both the interactions that you should do on a Watch as well as the design of the application.
Next, let's take a look at performance.
Now interactions on watches we've talked about previously, are short but numerous.
So we always want to make sure that we're both preparing ahead but we're also as responsive as possible.
And to that end, in watchOS 2, we moved the extension from running on the phone to running on the Watch.
And that did a couple of things.
It meant that you could run the app when the phone was no longer present but it also meant lower latency and communication.
The behind the scenes, the app and extension are still running in separate processes where your code is trying to make updates and you're responding to events.
So there's latency in the communication for the inner process communication between the two.
With a little bit of magic in watchOS 4, at run time, we're loading both the extension and the app into the same process.
This is going to make a huge difference in performance of your apps.
You should see things like lower touch latency, faster loading of views as well as higher frame rates while you're interacting with the device.
And the best part is you don't have to do anything for your users to gain from this.
This is a completely binary compatible change for all apps watchOS 2 and later.
That means no updates.
[Applause] No recompiling.
All existing apps either on a user's device or in the App Store are just going to start benefiting in watchOS 4.
This is going to make a huge difference.
So we can't wait for you to check it out.
I moved too far away.
And finally let's take a look at background processing.
Like I said before, it's really important to prepare ahead of time and making sure that the app is always up-to-date whenever the user wants to look at their wrist.
And this can be done with a combination of background running modes, use of the complication, and snapshot APIs as well as some changes that we're making this year for what will be called the Frontmost App State.
We'll get to that in just a few minutes.
Now last year we introduced the workout processing background mode allowing third party apps to run in the background and making the app available every time the user raised their wrist.
We're continuing to make these APIs better this year by adding a few new additions.
The first is a hardware pause and resume API.
When a user presses the side button and digital crown at the same time, an event is generated that you can respond to in your application.
That way you can pause and resume the workout depending on which state the session is in.
The second is workout segments.
And this allows you it's a new type on the HK [phonetic] workout event class and this allows you to mark important durations of time within your workout.
This could be used for things like marking the different sections of an interval training, for example.
And last year we started to track workout routes for specific types of workouts using the Apple Workout app.
Now with a user's permission, you can both read these workout routes as well as create your own.
Now if you already have a workout app or you're considering making one, you should check out the what's new in health session later this week which will be going through how to use these APIs as well as other changes in HealthKit that you should take advantage of.
Remember also adding a few new background modes in WatchKit this year.
The first of which is a location background mode.
This is great for things like location based games as well as turn-by-turn navigation apps.
And similar to workout apps, it'll always be available every time the user raises their wrist.
And if there's something that you need to alert the user to like when I've made a wrong turn, you can use audio and haptics from the background in order to get their attention.
And like I had mentioned before, there was another session based activity that you can also water lock mode with and this is that's location mode.
So you can use it in conjunction with water-based activities.
In order to conserve battery power, though, CPU in the background is limited.
So you need to monitor what things need to be done in the background and what can be saved for later.
And lastly, you must start the location session from the foreground just like a workout so that the user's always aware of what's going on.
And while you're accessing location, there will be a status indicator and control center so that they can always monitor their privacy.
And we've also added in-line audio recording as well as a background mode.
And recording has been available since watchOS 2 but it was only offered in a modal form where we would hand a file back to you after the user had finished their recording.
You could also continue recording when the user had dropped their wrist but it would keep the screen on for the entire time.
Now in watchOS 4, we're offering in-line audio recording to solve some of these problems.
First, you no longer are limited to the modal form so you can create your own custom U recording controls that fit the UI of your app.
You can also do in-line audio recording.
So if you wanted to look for a certain signature in the audio or if you wanted to do things like real time language translation on the watch.
And you can continue recording when the user has dropped their wrist but now it's a full background mode.
So you don't need to waste the additional battery power of keeping the screen on.
Imagine being able to walk into classroom and record an entire lecture right from your wrist.
And similar to other background modes in watchOS, the app will always appear every time the user raises their wrist.
It'll be CPU limited and the app must be started the session must be started from the foreground.
And while you're doing a recording, there will be an indicator on the watch face that the user can tap on to return to the recording app.
These background modes are going to make a huge difference in doing ongoing tasks in watchOS 4.
We're also supporting core Bluetooth on Watch in watchOS 4.
This [ Applause ]
This means you can connect directly to the Watch from your devices.
And get updated data with lower latency as well as continue use when the phone is no longer present.
And previously for Bluetooth devices, you'd have to connect with the phone and then shuttle data over using Watch connectivity.
Now you should get much faster updates.
And with core Bluetooth on the Watch, you can connect up to two peripherals.
And we're only supporting central mode which means that you need to you can connect to other devices but the Watch cannot be used as a peripheral itself.
And while you're in the foreground, there's a minimum time between samples of 30 milliseconds and when used in conjunction with the background mode, that time is limited to 120 milliseconds.
Now when used in conjunction with a background mode, background running apps can only connect not scan.
So you need to do your pairing and discovery process while the app is in the foreground.
Now when the app is suspended, the peripheral will automatically be disconnected and we will not wake up the app for newly advertised values.
So if you need ongoing updates, you need to use it in conjunction with the background mode.
If you want to learn more, you should check out the core Bluetooth session later this week but first let's take a look at an example of how an app can make a use of this.
So ReSound Smart 3D is an app that lets you connect to Bluetooth enabled hearing aids so you can change the listening environment depending on where you are.
So I can change from an outdoor listening environment to a restaurant, which has a pretty different audio profile just with a tap on my wrist.
And with watchOS 4, they can connect directly to the hearing aids so that they can make faster updates and they can continue using the device when the phone is no longer present.
And that's core Bluetooth.
[ Applause ]
Now I mentioned before though there's something called the Frontmost App State.
This is something that we're really excited about and I think it's going to change the way that we think about creating our Watch apps.
The experience of using a Watch app is very different from apps on other platforms.
When I use an iPhone app, for example, I open the app.
I use it for some period of time and eventually I close it by pressing the home button.
On a Watch app, though, I may use it for a much shorter period of time.
Perhaps just a few seconds but I may use the app dozens or more time within a single session.
For example, I may use the reminders app to go shopping at the grocery store to check off items as I'm putting them in my cart.
Every time I put something in my cart, I raise my wrist and the app is right there where I left it.
It makes it really easy for me to find the item that I'd like to check off and tap it and then get on with my shopping.
This period where we resumed to your app rather than the clock face is what we call the Frontmost App State.
In watchOS 3, that period of time was eight minutes between each wrist raise.
We found that this was often too long for users and they would end up in the same app long after they were finished using it.
So in watchOS 3.2, we changed this limit to two minutes.
And that happens between each wrist raise.
So for the most part, most activities will remain frontmost for the entire duration of using it but we recognize that there's some use cases in which you will need more than two minutes between each wrist raise.
And for that, we're allowing you to specify when you need to extend your frontmost time.
And that will change the time out back from two minutes out to eight minutes.
So let's take a look at how you enable this in code.
Like most of the other things that we've talked about today, it's a simple call on the shared extension.
It's a simple property.
You can set to true whenever you need to extend your frontmost time.
You must be judicious about this though because we don't want users to remain in apps long after they're finished using them.
So let's take a look back at my reminder shopping list example.
When I turn on when I open up the shopping list, I probably want to turn on and extended frontmost time so that if I had like an item between two aisles that took longer than two minutes, I wouldn't have to go back to open up the app.
But as soon as I've finished the items in my shopping list, it's probably a good opportunity to turn off extended frontmost time.
So that the app will just automatically close in the background without the user having to do anything.
Now in addition to giving you more flexibility for when you remain in frontmost, we're also changing some of the behaviors of the API so that you can have more up-to-date information and meet the expectations of users.
Now you can already extend your run time by up to 30 seconds using the expiring activity on NS [phonetic] process info.
And this is a great opportunity to do things like networking tasks.
And we've increased the priority of this request in watchOS 4 so that you can do more things in the time that you've requested.
And if Watch connectivity or url session data comes into your app while you're in the frontmost state, we will immediately resume your app and in most cases, the payload will begin downloading immediately as well.
And if there's important information that you recognize in that data, while you're in the frontmost state if you have run time, you can play haptics to alert the user.
And if a notification for your app comes in while you're in that state, you could also handle it using the user notification API just like you can when the app is in the foreground.
Let's take a look at an example that ties all of these capabilities together.
So here we have a simple ride-sharing app.
It's showing me that I have an expected five-minute wait time.
This is a great opportunity to turn extended frontmost time on because I already know it's pretty likely that the user's going to need longer than the two-minute timeout.
It's going to be a bit of a wait and I probably don't want to keep my wrist up the entire time.
So I tap on the request ride button and drop my wrist.
Now the screen may be off but I'm definitely not done using the app because I'm still waiting for the ride.
And at some point, the server's going to send a push notification that'll get forwarded to my Watch and at that point, the app can handle the notification and recognize that it's important information and play a haptic to alert me.
When I raise my wrist, the app has already been updated showing me important information like the arrival time as well as the driver's name and star rating.
Even the ability to call the driver.
At this point, I should turn off extended frontmost time because it's likely that the user's done using the app for now, at least.
Getting this frontmost state right will make your app feel like magic.
Always knowing when the user's done using your app as well as when they need more time in it.
And making sure that the data in your app is up-to-date and showing just what the user wants to see for the next time that they may use their app.
I'd highly encourage you to check out the session later today on the life of a watchOS app.
This will be going into detail about app life cycle events, making use of the frontmost state as well as background modes and more to make a great Watch experience.
To summarize, we've added a bunch of new capabilities to our user interface components to make them flexible, to create custom user interfaces like overlapping interface controllers as well as auto rotate mode.
We're changing the architecture of Watch apps to make them perform even better by loading the extension and an app into the same process at run time.
And we're adding new background modes as well as core Bluetooth support and the changes that we just went through for the frontmost app state, which should make it easier for you to keep your app up-to-date for users.
And I mentioned a number of sessions that you should check out this week to learn more about developing on the Watch platform.
If you want to get more information like the session links for videos as well as other resources, please visit the developer.apple.com link.
Thank you so much for coming to hear what's new in watchOS 4.
I can't wait to see what you guys build next.
[ Applause ]