Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Apple Watch App Development

You're reading from  Apple Watch App Development

Product type Book
Published in Apr 2016
Publisher
ISBN-13 9781785886362
Pages 358 pages
Edition 1st Edition
Languages
Author (1):
Steven F. Daniel Steven F. Daniel
Profile icon Steven F. Daniel

Table of Contents (19) Chapters

Apple Watch App Development
Credits
About the Author
Acknowledgements
About the Reviewer
www.PacktPub.com
Preface
1. Introducing the Swift Programming Language 2. Understanding Apple Watch 3. Exploring WatchKit Controls 4. Using the Core Location and Watch Connectivity Frameworks 5. Navigating Around in WatchKit 6. Implementing Tables within Your App 7. Adding Menus to Your App 8. Incorporating the Glance Interface in Your App 9. Incorporating Notifications within Your App 10. Image Compression and Animation 11. Packaging and Deploying Your App Index

Establishing the WatchKit context menu connections


There are two ways in which we can go about creating WatchKit context menu items. In the previous section, we discussed how we can drag and drop a WKInterfaceMenu control in InterfaceController within the storyboard that will contain the menu.

You can also create them programmatically using the WKInterfaceController method and provide an image, a title, and the associated action method that will get executed when the menu item is tapped by the user. Simply perform the following steps:

  1. Open the InterfaceController.swift file located within the ShoppingList WatchKit Extension group from the project navigation window.

  2. Next, locate the awakeWithContext method and enter the following highlighted code snippet:

    override func awakeWithContext(context: AnyObject?) {
       super.awakeWithContext(context)
            
       // Perform any final initialization of your application.
       if WCSession.isSupported() {
          let session = WCSession.defaultSession()
       ...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}