O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

Apple Watch and WatchKit - A Technical Overview

Carregando em…3

Confira estes a seguir

1 de 39 Anúncio

Mais Conteúdo rRelacionado

Diapositivos para si (18)


Semelhante a Apple Watch and WatchKit - A Technical Overview (20)

Mais recentes (20)


Apple Watch and WatchKit - A Technical Overview

  1. 1. Apple Watch and Apple WatchKit
  2. 2. • A look at Apple Watch • WatchKit • Structure and life cycle • WatchKit Framework • Creating watch app Content
  3. 3. A look at Apple Watch
  4. 4. Size & Screens
  5. 5. Sensors • Gyroscope • Measures angular velocity • Determine orientation of device • Accelerometer • Measures non-gravitational acceleration • Type of activity • Intensity of activity • Heart Rate monitor • Measure heart response to exercise • Physical training apps
  6. 6. Connectivity • Bluetooth Connectivity • Connectivity with phone • Connectivity with headphone or headsets. • Wireless Charging
  7. 7. Input Buttons and Gestures • Buttons • Digital crown • Conversation button • Gestures • Vertical scrolling • Horizontal swipe • Left edge swipe • Force touch • Tap
  8. 8. Communication • Glance • Notification • Short-look interface • Long-look interface • Watch Interface • Hierarchical navigation interface • Page-base navigation interface
  9. 9. WatchKit
  10. 10. WatchKit The apple watch requires an iPhone paired with it to run the apps without an iPhone the watch apps will not work. For creating watch app we need two separate bundles • WatchKit app The watch kit app contains only storyboard and resource files associated with our apps UI. • WatchKit extension The WatchKit extension contains the code for managing the WatchKit app’s UI and for responding user interactions. Since both of these bundle are packed in side the ios app so during the installation of the app the system prompts the user to install the watchkit app when a paired watch is present
  11. 11. Structure and life cycle
  12. 12. App Structure
  13. 13. Communication between Watchkit App VS Watchkit extension
  14. 14. Watch app Launching
  15. 15. Watch app life cycle
  16. 16. WatchKit Framework
  17. 17. A look at WatchKit framework The whole apple watch is managed by the few classes the most used are as • WKinterfaceController • WKUserNotificationInterfaceController • WKInterfaceDevice • WKInterfaceObject
  18. 18. A look at WatchKit framework WKInterfaceController in WatchKit is the same as UIViewController in UIKit. WKInterfaceController is a lot more restricted and has a different life cycle. There are different methods to work with as following. UIViewController WKInterfaceController likeviewDidLoad Init loadView awakeWithContext ViewWillAppear WillActivate ViewWillDisappear didDeactivate
  19. 19. A look at WatchKit framework • WKUserNotificationInterfaceController Its a WKInterfaceController subclass that is used to display custom notification interfaces. • WKInterfaceDevice This class contains basic information related to the iWatch. This includes screen bounds, scale and current locale. You can also use it to manage your images cache. WatchKit allows you to store up to 20 MB of cached images on the iWatch.
  20. 20. A look at WatchKit framework • WKInterfaceObject This is the base class for all UI controls supported by WatchKit. As we cannot use UI views from UIKit. All we can do is use the ones that WatchKit provides. • WKInterfaceButton • WKInterfaceDate • WKInterfaceGroup • WKInterfaceImage • WKInterfaceLabel • And more
  21. 21. A look at WatchKit framework • Watchkit layout WatchKit does not use Auto layout to position it’s element. This is because it might have been too complex for the slow iWatch. Instead we have a layout system that positions elements relative to each other in a horizontal or vertical order.
  22. 22. A look at WatchKit framework • Glances The apple watch is designed so that user can have a quick access to the information from the app on iPhone. This is achieved by “Glance Interface controller” which is non- scrollable view with the precise info and user can launch the app by tapping in it or can close it. Apple prohibits using any interfaceObject on this screen because “Glances do not support interactivity—tapping on a glance automatically launches your WatchKit app”
  23. 23. A look at WatchKit framework • Static notification interfaces It is a simplified version of notification appearance, it contains static image and text. Only notification text can be changed. • Dynamic notification interfaces It allow you to specify a custom controller to display notification. Dynamic notification are not interactive and should be designed to display the info, tapping on it will launch the application
  24. 24. Sharing data with containing iOS app This can be done with by different methods which are as following • By NSUserDefault we can create and init the object of user default by initiating with initwithSuiteName • By NSFilemanager we can create a shared container using group id [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:@"gr oup.com.swenggco.TodayExtensionApp"];
  25. 25. Sharing data with containing iOS app • By openParentApplication:reply: method we can communicate directly with containing app by calling the openParentApplication:reply: method, which iOS launches or wakes the containing iOS app in the background and calls the application:handleWatchKitExtensionRequest:reply: m ethod of its app delegate. The app delegate performs the request using the provided dictionary and then returns a reply to the WatchKit extension.
  26. 26. Creating watch app • First we need to add watch app target to the iOS project. To do this, select your project in the explorer and click the + button at the bottom of the project.
  27. 27. Creating watch app
  28. 28. Select WatchKit App and hit Next
  29. 29. Select Finish when you are done
  30. 30. Now we have two new folders in project directory
  31. 31. Setup an app group App Groups are the scheme iOS uses to allow different apps to share data. If the apps have the right entitlements and proper provisioning, they can access a shared directory outside of their normal iOS sandbox. To create groups we have to turn on “app groups” entitlement in Xcode for app and also for the extension. When you flip that switch, Xcode will talk to the developer center to configure your app ID for app groups. Then you can select a group or create a new one.
  32. 32. Setup an app group
  33. 33. Setup an app group
  34. 34. Share a classes or framework • We can also use a class a framework in watch extension from the main project by selecting extension from “Target membership” in “file inspector”.
  35. 35. Share a classes or framework
  36. 36. Now every thing is setup developing the watch app. Add more WKinterfaceController start building your watch app.
  37. 37. References https://developer.apple.com/library/prerelease/ios/documen tation/General/Conceptual/WatchKitProgrammingGuide/ https://developer.apple.com/library/prerelease/ios/documen tation/UserExperience/Conceptual/WatchHumanInterfaceG uidelines/index.html#//apple_ref/doc/uid/TP40014992-CH3- SW1 http://swiftiostutorials.com/watchkit-tutorial/ http://stablekernel.com/blog/watchkit-sharing-app-data/
  38. 38. Need help launching your great Apple Watch App. Swenggco Software Email: sales@swenggco-software.com Web: www.swenggco-software.com Thanks