Build apps for Apple Watch

54
BLINKAR TITLE WHO COMPANY FRANCESCO NOVELLI BUILD APPS FOR APPLE WATCH

Transcript of Build apps for Apple Watch

BLINKAR

TITLE

WHO COMPANYFRANCESCO NOVELLI

BUILD APPS FOR APPLE WATCH

Who I am?

iOS Developer since 2009

Web Developer (LAMP)

Development Book Author

Freelance and Consultant

Apple Lovers

Thanks to BLINKAR

www.blinkar.com

Agenda

What is it an Apple Watch?

SDK history

App

Notifications

Complications

Final thoughts

WHAT IS IT AN APPLE WATCH

“It's the most personal product we've ever made”

–Tim Cook

What is it an Apple Watch

Watch!

iPhone external device

Notification reader

Sport&Life tracker

FAST DEVICE

When user raise the wrist is import to show what REALLY matter

Users DO NOT want loading on wrist

Users DO NOT want tap more than 2 times to get what they want

SMALL DEVICE

Screen is tiny

Tapping is NOT the only solution

Input device are various

Microphone IS a solution for SOME problem, not every problem

APPLE SDK: WATCHKIT

watchOS 1

iOS-based OS

Native Apps with watchOS 2.0

iPhone connectivity framework

Need an iPhone companion app

watchOS 2Complications

iPhone connectivity framework

Time Travel

Watch execute its own apps & Apps works also without an iPhone

Apps can interact with “all” sensor of Watch

Simple animation allowed

NEW

NEW

watchOS 3Performance Performance Performance!

Dock Interface

NEW API

Background app refresh

Simplifying navigation

New Notification

NEW

PerformanceFullscreen app MAYBE NOT the best way to use your app

Preload data

Simplifying UI

Use ALL CPU you need

Simulate async things (if you are confident with the task)

Dock

User can dock your application

Easiest way to interact with your app

Show only important information

Simplifying the interaction

NEW API & FRAMEWORKS

SpriteKit

SceneKit

Inline Video

GameKit

CloudKit

Apple Pay

Digital Crown API

NEW Workout API

Speaker API

Background App Refresh

Use it for update snapshot of Docked App

Complications have 50 slot in a day

Normal apps has 24 updates in a day. (at least)

Choose the best time for the user

We can schedule or start refresh from push or iPhone

APPLE WATCH APPS

APPS

YOUR APP!

Apps: 2 components

The Watch app contains the storyboards and resource files associated with all of your app’s user interfaces.

The WatchKit extension contains the code for managing those interfaces and for responding to user interactions

Different between watchOS 1 and 2: WatchKit extension on watchOS 1 was on IPhone

Apps: 2 components

Code Files

StoryBoard, Images, Plists

Apps: User Interface

Based on Storyboard

Different From iOS: it’s NOT a white board

Xcode arranges items for you, stacking them vertically on different lines.

You can customize scenes for different Apple Watch sizes, and you can configure different aspects of your interface.

Apps: User Interface

Apps: User Interface

Apps: Navigation

Page-Based: storyboard

Hierarchical Interface: pushControllerWithName:

Modally: presentControllerWithName:

Apps: Context Menu?Optional

Force Touch to activate context menu

MUST follow Apple Watch HIG

Configurable with storyboard or Code (addMenuItemWithImage:title:action:)

Easy way to avoid too much modal interface

Apps: SettingsOnly on iPhone (Apple Watch App) with Settings Bundle

UserDefaults can be shared with iOS Companion app

Settings in iOS App

NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.example.watchApp"];

BOOL enabled = [defaults boolForKey:@"enabled_preference"];

Apps: WatchConnectivity.framework

two-way communications between an iOS app and a Watch App

pass files and data back and forth

works in background also with inactive apps

Live communication if both apps are active

Simplifying Navigation

In watchOS 3 Apple has simplified their apps. It’s our turn

Digital Crown for simple interface

WKTable has new option

For 8 minutes last app used will be shown when user raise the wrist

Apps: Recap

Native apps that works on the Apple Watch (watchOS 2.0)

Keep interface simple and follow Apple HIG

Do not use only modal

Interact with iPhone App

NOTIFICATIONS

NotificationThe most important part of Apple Watch

Everyone will see notification on Apple Watch

Notification

Every apps works by default

iPhone will decide where show the notification

Developers can personalize notification

Users can interact with notification

Users must allow apps to send notification on their iPhones

Notification: Looks

Short-Look Interface (last only 2 seconds)

Long-Look Inteface (last until users dismiss the notification)

Notification: Short-Look

Can NOT be personalized

Show only when the user raise its wrist

Automatically show the Long-Look if the users keep watching the Apple Watch

Notification: Long-LookDeveloper can design its own notification

It’s scrollable

Show notification content and actions

Actions are the same of the iPhone Notification

Actions can support text reply

Notification: Actions

Must be set on the iPhone app

Setting activation mode background will execute code on iPhone

Foreground activation will open Watch app

Notification: Customize Long Notification

Must exist a static version of notification

Developers can create a dynamic version of notification with custom design

watchOS will try to show the dynamic version, but if it’s too slow will show the static version

Notification: Static

Can be personalized only the top band color and text formatting

watchOS will set only the label notificationAlertLabel with message of notification

Must be created using a storyboard

Notification: DynamicAll interface can be personalized

A subclass of WKUserNotificationInterfaceController configures the interface

Can include images and other UI controls

Use maps and table less possible

Do not include buttons, switches, or other interactive controls.

Notification: Dynamic HOW TO

- (void)didReceiveRemoteNotification:(NSDictionary *)remoteNotification withCompletion:(void(^)(WKUserNotificationInterfaceType interface)) completionHandler { // Get the aps dictionary from the payload. NSDictionary* apsDict = [remoteNotification objectForKey:apsKeyString]; // Set text of labels... NSString* titleString = [apsDict objectForKey:titleKeyString]; [self.titleLabel setText:titleString]; // Tell WatchKit to display the custom interface. completionHandler(WKUserNotificationInterfaceTypeCustom); }

Notification FROM the watch

NEW on watchOS 3

We can schedule right on the watch

Works also without an iPhone

App can decide in which device show the notification

App can demand decision to the OS

Notification: Recap

Notification are the most important things on Apple Watch

Can be personalized if exist an Apple Watch app

Provide a better experience with custom interface

Dynamic Interface must be fast to show or users won’t see your amazing interface

COMPLICATIONS

ComplicationsNEW in watchOS 2.0

It’s not an Apple name; exist from years in watch industries

Can be integrated in every apps

Various style based on clock interface

Uses ClockKit.framework

Apple Default Complications

Complications: Types

Complications: HOW TOWorks like a timeline

You need to preload information

Users can “time travel” with digital crown

Complications: Summary

Cannot load data when users raise its wrist or when start time traveling; must be preloaded

Preload cannot work for every complications

Refresh when whenever the app works

Keep data updates and show only useful things

Complications: More…

WWDC ’15 Session 209 Creating complications with ClockKit

ClockKit Framework Reference (developer.apple.com)

FINAL THOUGHT

Build Apple Watch Apps

Apple Watch is big opportunity for developers

Apple Watch users love to have their apps on the wrist

Different types of “apps”: choose the best one

Apple Watch is: small&fast device. Keep it in mind during UX Design

Thanks! Q&A Time

Francesco Novelli [email protected]

@if9

http://www.9lli.it/francesco

www.blinkar.com