Building apps for Apple Watch

Post on 17-Jul-2015

892 views 1 download

Transcript of Building apps for Apple Watch

Building Apps for WATCH

Vikram Kriplaney

ArchitectureWatchKit

WatchKit Extension

WatchKit App

Code +

Resources

Storyboard +

Resources

WatchKit AppNavigation

Two Choices

Hierarchical Page-Based

WatchKit Framework

• Like UIViewController

• Outlets

• Actions and targets

WKInterfaceController

WatchKit FrameworkUI Elements

WKInterfaceLabel

WKInterfaceButton

WKInterfaceSwitch

WKInterfaceSlider

WatchKit FrameworkUI Elements

WKInterfaceImage WKInterfaceSeparator WKInterfaceMap

WatchKit FrameworkUI Elements

WKInterfaceTimer WKInterfaceDate

Wot, no getters?let label = UILabel(…) label.setText(“Hello world”) label.getText()

By design, information is only sent over Bluetooth to the Watch.

Wot, no text input?

[WKInterfaceController presentTextInputControllerWithSuggestions…

WatchKit FrameworkUI Elements

• Layout

• Horizontal

• Vertical

• Margins & spacing

• Background

WKInterfaceGroup

WatchKit FrameworkUI Elements

• Dynamic content

• Multiple row types

• Row Controller

• Selection handled by WKInterfaceController

WKInterfaceTable

WatchKit FrameworkWKInterfaceTable

let entries = model.entries as [PhoneBookEntry]

table.setNumberOfRows(entries.count, withRowType: "ResultRow")

for (index, entry) in enumerate(entries) { if let row = table.rowControllerAtIndex(index) as? ResultRow { row.label.setText(entry.title) } }

Demo-tai?

WatchKit FrameworkApplication Lifecycle

Application Lifecycle

WatchKit Framework

Application Lifecycle

WatchKit Framework

Application Lifecycle

WatchKit Framework

Application Lifecycle

WatchKit Framework

Application Lifecycle

WatchKit Framework

Application Lifecycle

WatchKit Framework

WatchKit FrameworkUI Elements

• Width & Height

• Size to Fit

• Relative to Container

• Fixed

• Alpha

• Hidden (“GONE”)

• Accessibility

WatchKit FrameworkWKInterfaceDevice

• Device Information

• Screen Bounds

• Scale

• Content Size Preference

• Image Caching

WatchKit AppGlances

• Template-based

• Tap launches Watch app

• Context

WatchKit AppNotifications

Short Look Long Look

WatchKit AppNotifications

• Local or Remote

• Category Types

• Customizable

WatchKit AppAdvanced Topics

• Handoff API

• Animation with Images

• Image Cache

• Sharing Data

• Shared Frameworks

Some Resources

• developer.apple.com/watchkit

• infinitapps.com/bezel

• www.watchkitresources.com

• Ray Wenderlich – WatchKit Tutorial with Swift: Getting Started

Typography

• San Francisco Regular

• San Francisco Medium

• San Francisco Semibold

• San Francisco Bold

• San Francisco Heavy

• San Francisco Black

• San Francisco Light

• San Francisco Thin

• San Francisco Ultralight

Subtitle