65
HOW TO BUILD A COMPELLING WATCH APP KRISTINA THAI @kristinathai

How to Build a Compelling Apple Watch App/Complication

Embed Size (px)

Citation preview

Page 1: How to Build a Compelling Apple Watch App/Complication

HOW TO BUILD A COMPELLING WATCH APP

KRISTINA THAI

@kristinathai

Page 2: How to Build a Compelling Apple Watch App/Complication

@kristinathaiHI. I’M KRISTINA

📱 ⌚ 🍦

Page 3: How to Build a Compelling Apple Watch App/Complication

HOW TO BUILD A COMPELLING WATCH APP

KRISTINA THAI

Page 4: How to Build a Compelling Apple Watch App/Complication

HOW TO BUILD A COMPELLING WATCH APP

Page 5: How to Build a Compelling Apple Watch App/Complication

COMPELLINGevoking interest, attention, or admiration in a powerfully irresistible way

Page 6: How to Build a Compelling Apple Watch App/Complication

NEW

ACTIONABLE

RESPONSIVE

GLANCEABLE

Page 7: How to Build a Compelling Apple Watch App/Complication

NEW

ACTIONABLE RESPONSIVEGLANCEABLE

Page 8: How to Build a Compelling Apple Watch App/Complication

1. FIND A GOOD USE CASEOr don’t build one at all.

Page 9: How to Build a Compelling Apple Watch App/Complication

@kristinathai

Page 10: How to Build a Compelling Apple Watch App/Complication

@kristinathai

Page 11: How to Build a Compelling Apple Watch App/Complication

@kristinathai

Page 12: How to Build a Compelling Apple Watch App/Complication

2. QUICK ACTIONS ARE KEY

Page 13: How to Build a Compelling Apple Watch App/Complication

@kristinathai

http://www.imore.com/apple-watch-usage-survey-study-2015-q2

Page 14: How to Build a Compelling Apple Watch App/Complication

@kristinathai

Page 15: How to Build a Compelling Apple Watch App/Complication

@kristinathai

let suggestions = [“Hello world!”, “I’m on my way"] presentTextInputControllerWithSuggestions(suggestions, allowedInputMode: .AllowEmoji)

{ (input) -> Void in if let userInput = input?.first { // Do something with user input here self.contentLabel.setText(userInput as? String) } }

Page 16: How to Build a Compelling Apple Watch App/Complication

@kristinathai

NEW

Page 17: How to Build a Compelling Apple Watch App/Complication

@kristinathai

Page 18: How to Build a Compelling Apple Watch App/Complication

3. USE ANIMATIONS

Page 19: How to Build a Compelling Apple Watch App/Complication

@kristinathai

Simple Designs

Page 20: How to Build a Compelling Apple Watch App/Complication

@kristinathai

NEW

Page 21: How to Build a Compelling Apple Watch App/Complication

@kristinathai

Page 22: How to Build a Compelling Apple Watch App/Complication

@kristinathai

Page 23: How to Build a Compelling Apple Watch App/Complication

@kristinathai

Page 24: How to Build a Compelling Apple Watch App/Complication

@kristinathai

@IBOutlet var spacerGroup: WKInterfaceGroup! @IBAction func animate() { animateWithDuration(0.3, animations: { self.spacerGroup.setWidth(0) }) }

@IBAction func reset() { self.spacerGroup.setWidth(100) }

Page 25: How to Build a Compelling Apple Watch App/Complication

@kristinathai

Page 26: How to Build a Compelling Apple Watch App/Complication

4. DEVICE-TO-DEVICE COMMUNICATION

Page 27: How to Build a Compelling Apple Watch App/Complication

WATCH CONNECTIVITY

Page 28: How to Build a Compelling Apple Watch App/Complication

@kristinathaiWATCH CONNECTIVITY

WCSESSION

▸ Facilitates communication between WatchKit extension & companion iOS app

▸ Needs to be configured on both devices

Page 29: How to Build a Compelling Apple Watch App/Complication

@kristinathaiWATCH CONNECTIVITY

WCSESSION CONFIGURATIONimport WatchConnectivity

class InterfaceController: WKInterfaceController, WCSessionDelegate {

}

private let session : WCSession? = WCSession.isSupported() ? WCSession.defaultSession() : nil

override init() { super.init() session?.delegate = self session?.activateSession() }

Page 30: How to Build a Compelling Apple Watch App/Complication

@kristinathaiWATCH CONNECTIVITY

SENDER AND RECEIVER

applicationData⌚

Page 31: How to Build a Compelling Apple Watch App/Complication

@kristinathaiWATCH CONNECTIVITY

SENDER AND RECEIVER

applicationDatatransferUserInfo( )⌚

Page 32: How to Build a Compelling Apple Watch App/Complication

@kristinathaiWATCH CONNECTIVITY

SENDER AND RECEIVER

applicationDatatransferUserInfo( ) didReceiveUserInfo( )📲⌚

transferUserInfo( ) didReceiveUserInfo(📲 ⌚

applicationData)

Page 33: How to Build a Compelling Apple Watch App/Complication

@kristinathaiWATCH CONNECTIVITY

COMMUNICATION CATEGORIES

Background transfers Interactive messaging

Information isn’t needed immediately

Information needed immediately

Operating system determines the most suitable time to send

the data

Requires reachable state

Content is queued for transfer

Page 34: How to Build a Compelling Apple Watch App/Complication

@kristinathaiWATCH CONNECTIVITY

SENDER AND RECEIVERS - BACKGROUND TRANSFERS

Data Type Sender Receiver

Dictionary (overwrite latest data) updateApplicationContext didReceiveApplicationContext

Dictionary (keep all data - FIFO) transferUserInfo didReceiveUserInfo

File, Dictionary (metadata) transferFile didReceiveFile

Page 35: How to Build a Compelling Apple Watch App/Complication

@kristinathaiWATCH CONNECTIVITY

SENDER AND RECEIVERS - INTERACTIVE MESSAGING

Data Type Sender Receiver

Dictionary sendMessage didReceiveMessage

NSData sendMessageData didReceiveMessageData

Page 36: How to Build a Compelling Apple Watch App/Complication

@kristinathaiWATCH CONNECTIVITY

2 NEW WATCH CONNECTIVITY PROPERTIES

‣ hasContentPending

‣ Checks if session data has been received in background that needs to be delivered

‣ remainingComplicationUserInfoTransfers

‣ Gives you remaining number of times you can send complication data from iOS app to WatchKit extension

NEW

Page 37: How to Build a Compelling Apple Watch App/Complication

5. CLOCKKIT

Page 38: How to Build a Compelling Apple Watch App/Complication

COMPLICATIONSCLOCKKIT

Page 39: How to Build a Compelling Apple Watch App/Complication

@kristinathai

Page 40: How to Build a Compelling Apple Watch App/Complication

@kristinathai

Page 41: How to Build a Compelling Apple Watch App/Complication

@kristinathai

https://theswiftdev.com/2016/04/28/clockkit-complications-cheat-sheet/

CLKComplicationTemplate

Page 42: How to Build a Compelling Apple Watch App/Complication

@kristinathai

Page 43: How to Build a Compelling Apple Watch App/Complication

@kristinathai

Page 44: How to Build a Compelling Apple Watch App/Complication

@kristinathaiCLOCKKIT

TEXT PROVIDERS

▸ Smartly truncate & display text in watch complications

▸ Available for most data types

Page 45: How to Build a Compelling Apple Watch App/Complication

@kristinathaiCLOCKKIT - TEXT PROVIDERS

CLKSimpleTextProvider

let textProvider =

CLKSimpleTextProvider(text: "your string here", shortText: "string")

Page 46: How to Build a Compelling Apple Watch App/Complication

@kristinathaiCLOCKKIT - TEXT PROVIDERS

CLKDateTextProviderThursday, January 14, 2016

Thursday, January 14

Thursday, Jan 14

Thurs, Jan 14

Jan 14

14

let textProvider = CLKDateTextProvider(date: NSDate(), units: .Day)

Page 47: How to Build a Compelling Apple Watch App/Complication

@kristinathaiCLOCKKIT - TEXT PROVIDERS

CLKTextProvider - Custom text provider

CLKSimpleTextProvider *textProvider1 = [CLKSimpleTextProvider textProviderWithText:@"your string here" shortText:@"string"];

CLKTextProvider *textProvider = [CLKTextProvider textProviderWithFormat:@"%@ & %@", textProvider1, textProvider2];

CLKSimpleTextProvider *textProvider2 = [CLKSimpleTextProvider textProviderWithText:@"your string here" shortText:@"string"];

Page 48: How to Build a Compelling Apple Watch App/Complication

DATA POPULATIONCLOCKKIT

Page 49: How to Build a Compelling Apple Watch App/Complication

@kristinathaiCOMPLICATION TIMELINE

https://developer.apple.com/videos/play/wwdc2015/209/

Page 50: How to Build a Compelling Apple Watch App/Complication

@kristinathai

Page 51: How to Build a Compelling Apple Watch App/Complication

@kristinathai

Optional

NEW

Page 52: How to Build a Compelling Apple Watch App/Complication

@kristinathai

// MARK: - Timeline Population

func getCurrentTimelineEntryForComplication(complication: CLKComplication, withHandler handler: ((CLKComplicationTimelineEntry?) -> Void)) {

// Call the handler with the current timeline entry

handler(nil)

}

1: CURRENT TIMELINE ENTRY

Page 53: How to Build a Compelling Apple Watch App/Complication

6. ACCESSIBILITY = INCLUSIVITY

Page 54: How to Build a Compelling Apple Watch App/Complication

@kristinathai

15% OF THE WORLD’S POPULATION LIVES WITH SOME FORM OF DISABILITY

World Health Organization

WORLD REPORT ON DISABILITY

http://www.who.int/disabilities/world_report/2011/report/en/

Page 55: How to Build a Compelling Apple Watch App/Complication

@kristinathai

https://twitter.com/dstorey/status/649636741033279488

Page 56: How to Build a Compelling Apple Watch App/Complication

@kristinathai

Page 57: How to Build a Compelling Apple Watch App/Complication

@kristinathai

@IBOutlet var userInputButton: WKInterfaceButton! override func awakeWithContext(context: AnyObject?) { super.awakeWithContext(context) // Configure interface objects here. userInputButton.setAccessibilityLabel("Take user input") userInputButton.setAccessibilityHint("Open dictation") }

Page 58: How to Build a Compelling Apple Watch App/Complication

@kristinathai

NEW

Page 59: How to Build a Compelling Apple Watch App/Complication

@kristinathai

enum WKHapticType : Int { case Notification case DirectionUp case DirectionDown case Success case Failure case Retry case Start case Stop case Click}

Page 60: How to Build a Compelling Apple Watch App/Complication

@kristinathai

playHaptic(.Notification)

Page 61: How to Build a Compelling Apple Watch App/Complication

@kristinathaiRESOURCES

ANIMATIONS & TEXT INPUT

▸ http://kristina.io/watchos-2-tutorial-animations-using-groups/

▸ http://natashatherobot.com/watchkit-text-input-dictation-api/

Page 62: How to Build a Compelling Apple Watch App/Complication

@kristinathaiRESOURCES

WATCH CONNECTIVITY

‣ http://kristina.io/watchos-2-how-to-communicate-between-devices-using-watch-connectivity/

‣ http://kristina.io/watchos-2-tutorial-using-sendmessage-for-instantaneous-data-transfer-watch-connectivity-1/

‣ http://kristina.io/watchos-2-tutorial-using-application-context-to-transfer-data-watch-connectivity-2/

Page 63: How to Build a Compelling Apple Watch App/Complication

@kristinathaiRESOURCES

CLOCKKIT

▸ http://kristina.io/clockkit-tutorial-add-complication-to-an-already-existing-watch-project-clockkit-1/

▸ http://kristina.io/clockkit-deep-dive-text-providers-clockkit-2/

▸ http://code.tutsplus.com/tutorials/an-introduction-to-clockkit--cms-24247

▸ https://theswiftdev.com/2016/04/28/clockkit-complications-cheat-sheet/

Page 64: How to Build a Compelling Apple Watch App/Complication

@kristinathaiRESOURCES

ACCESSIBILITY

‣ https://www.youtube.com/watch?v=nqX2rNbZSyg (Apple Watch Accessibility by Paul Adam)

‣ http://www.sneakycrab.com/blog/2015/6/22/haptic-feedback-with-the-taptic-engine-in-watchkit-and-watchos-2-wkinterfacedevice-and-wkhaptic

Page 65: How to Build a Compelling Apple Watch App/Complication

THANKS! @kristinathai

[email protected]

kristina.io