Learn about what a context is, and go into detail about using context in awakeFromContext. Learn how to move contexts programmatically.
- [Narrator] I've been a context nil…for the Present and PushController methods.…In Watch OS, context is how we send values…from one interface controller to another.…In this lesson, I'll show you how to…use the context to move values.…Take a look at the pushToThree method.…Currently, the pushController method…has a context of nil.…We change the value of context to send values…to the destination's controller.…The awake method's big job is to take the context…and translate it into values…the destination controller can use.…
Delete the nil.…Change it to context.…Add above the pushController, let context = "Pizza".…This is context string that will…pass the awake method in the three controller.…In the three controller you'll downcast it…because this is of type Any and you want type String.…Go over to awake in three.…And you'll see the context is an optional Any.…
We'll unwrap the optional and then…cast the context to the string.…Put in here just under Three Awake,…I'm going to get rid of this Configure interface objects here.…
- 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
- Creating tables
- Working with table data
Skill Level Intermediate
1. A Look at the Apple Watch App
2. Building Your First Apple Watch App
3. Working with UI in watchOS
5. Interface Library
6. Tables and Scrolling
Next steps1m 57s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.