Context in segues

- [Instructor] Sending a context through a segue…requires a few different steps to set up and code.…To demonstrate, I'll change the title on the two controller.…Shut things down here.…I'll be using the same dictionary,…so we can use the same code in awake withContext…that we used in the three controller.…So I'm going to take it, copy it,…and then awake withContext, paste it.…

Head back over to the interface.storyboard.…Select the segue between one and two,…and I'm going to do a fresh segue here…and assume that we're just doing this from scratch,…and so what you would be doing…is you would be doing control-drag from the button two…to the two interface controller,…release, we're doing the push,…pull up the attributes inspector,…select the segue, and type toTwo…just like prepare for segue in iOS,…you need an identifier to pass contexts.…

So, in the attributes inspector,…we've added toTwo and now we can go ahead…and close the attributes inspector after we hit return…and notice that we don't have any spaces…or anything else there that would mess up that identifier…

Resume Transcript Auto-Scroll

Author

Released

11/30/2017

There are over 2 million iOS apps available in the App Store, but less than 1% work on the Apple Watch. This underserved market is a great opportunity for Apple developers. Learn how to use your existing skills—plus the tools in Xcode 9 and watchOS 4—to create apps for Apple Watch. In this course, Steven Lipton shows you how to build a simple watchOS app, and then demonstrates the key differences from iOS, such as the watch picker, haptics, and the digital crown. Along the way, he shows how to create quick layouts with Interface Builder, navigate between controllers, enable dictation for text controls, and build tables. With these tips, you can quickly transition from iOS to watchOS app development and start entering the world of programming for wearable devices.

Topics include:

Principles of watchOS development

Adding buttons and labels to your app

Connecting objects to code

Testing a watchOS app

Laying out WatchKit UI objects

Adding navigation

Using Interface Library elements such as inputs, pickers, and media players