[MUSIC] All right. This final lecture of this module we're going to look at navigation. And, again, I keep emphasizing this point, but watch OS2 was much more simple and everything. And there's just less ways to do things, and that's actually a very nice change after doing, if you do a while of iOS and you come to develop for the watch. So in the watch, navigation can only really be done in two ways. One is a page based layout, where you scroll through views. And an example would maybe be like the glances. A view of the the glances. You get the dots on the bottom, and you scroll up and right between the views. Remember how the watch UI does not allow you to scroll left and right. That's because that is, sort of reserved for scrolling between pages. Or, you can push and that's very similar to the navigation controller on iOS. You can have a navigation stack as well on, on the watch. But the difference is that these are actually mutually exclusive. When you build your app, you generally choose one of those and you run with it. You think about what's best for your app, if it displays information, different kinds. You can use a page base and swipe between them. It's sort of a hierarchical UI where you can press a button to go to a next page and etc. Then you would push and do the navigation. And these are really the only two options you have. A third, sort of option, is you can do modal presentations, just like in IOS, like the present view controller where a view pops up from the bottom, takes over the whole screen. Now, you can also do that but that's not, so you can use that for sort of temporary presentations, but not really for the navigation for your whole app. All right, so let's see how we can do that. So we're going to add a new interface controller over here. And we're going to see the, we're going to, if you just control and drag from one control, then next, you can create a pitch relationship. And so now, this guy is the next pitch to this guy. And that's it. That's all you have to do, and that's how simple everything is. Now when you run your app you have two pages. How do they talk to each other? Well, they can awake with context. They don't really, they're independent right? So, because you, nothing, like it's not, you don't do anything here in order to go to next page. It just goes. And remember the life cycle methods, when you're leaving. When I just do this, will active gets called on this guy. Deactivate gets called on that guy and everyone's happy. That guy deactivates, this guy activates, and only one interface control is running at a time, which saves battery. So back to the storyboard. In order to push, you would have to drag from a button, right? Some action would have to trigger it. You could also do it in code and reference the interface control there by title, or by identifier, and we can show you that soon. So this would be the, let's say we'll call it the destination because we push to it. So to do it from the storyboard, you would just hold the Ctrl, you would drag from the button, Just like you, having trouble doing this today. You would hold Ctrl, you would drag the button to the destination and you can do push. And here's the option for modal as well, but again, that's sort of the same presenting. Now you get this little arrow here. That's the back button. And if this has a title, for example this is a destination. It actually displays the title instead of back button. And this is just a different paradigm, because the watch is so small, saying back is just a waste of space. So this is really a title for this view control. But, remember how I said that these were mutually exclusive? You can't have both the page navigation and the push net sort of navigation in the same app in the same sort of view hierarchy. This won't actually work. It'll still be just a page. And when you press the button, nothing will actually happen, so it just ignores this. So in order to make it work, we're going to delete that segue. And now when we push the button, we should be able to get our segue. Sweet. And you can go back and go forward. Again, the interface, the life cycle methods get called, except that on this button press, you can customize the destination, if you want, in code. So that's a little bit different. So, you can have multiple buttons leading to the same destination, but depending on the button you can actually customize the destination view. Now, that's really it. You can just build out your app. You can create the interface controllers. You can push to one another. You can create more pages, or you can do modals. So modals are kind of they're kind different. I'm just going to show you what it looks like. When you print the modal, it comes up full screen. Just like on iOS. It is meant to be temporary, because there is a back button here that you actually, you can't remove. So if you wanted to, say, go from one section of the app to another, this is not a good way to do it, because you could just, users can dismiss it and you can't make them not do that. What you could do, however, which is supported, is just completely swap out the current interface. Say you had two modes. You could press a button and then swap in this interface. And now, you can transition from the navigation or this modal into a page-based controller, if you wanted to, down here. And you can pass context around and initialize your views like that. So, that's basically it for watch navigation. With this, you can build multiple pages. You can navigate between them easily. If you're sharing information, you can just have all these be a page controller. [LAUGH] And, it's just difficult for some reason to do this dragging thing today for me. And voila, that's all you really need. You get pages in your app. You could display all the information you need to, and the implementation is just pretty simple. So you can just scroll from this guy to the next and back. And if it has a title, it'll display a title. All right? So, I hope you have fun creating your watch app, and I can't wait to see what you guys come up with.