MacKuba

Kuba Suder's blog on Mac & iOS development

Creating Independent Watch Apps

Categories: WWDC 19, WatchKit 0 comments Watch the video

iPhone app is now optional

Added new features to make Watch apps more independent

Up to watchOS 5, the Watch app is embedded in the iOS app and both are downloaded to the iPhone. iPhone then handles the task of installing the Watch app to the Watch.

Now, in iOS 13 and watchOS 6, both apps are installed straight from the App Store directly on the relevant device, each device installs its own app. This applies to all apps in the store today. iOS app no longer has the Watch app bundled inside, it no longer counts towards your iOS app cellular download limit if you don't need it.

This also enables asset/variant thinning for Watch apps – if you have a Series 4 watch, only Series 4 assets are downloaded to the watch (previously the iOS app had to include all variants in the bundled Watch app for any possible watches).

All current apps belong to the category of “dependent apps”, i.e. the Watch app depends on the iOS app. If you install a dependent app on the Watch, the iPhone will automatically install the matching companion iOS app. (Watch app launch is blocked until the iOS app is installed.)

On the other hand, independent apps can live without their iOS counterpart installed. They are backwards-compatible with earlier OSes.

→ to make an app independent, check the checkbox “Supports Running Without iOS App Installation”

Watch-only apps – apps that do not even have an iOS counterpart – are also possible, they require watchOS 6.

Debugging in the simulator is now up to 10x faster, on the device up to 2x faster

Added text field control (WKInterfaceTextField) to let you implement sign in forms

Use WKAlertAction for terms & conditions

Sign In With Apple (AuthenticationServices, WKInterfaceAuthorizationAppleIDButton)

Continuity keyboard for Watch ⭤ iOS – you can e.g. enter passwords to log in on the watch using your iOS device

For proper handling of logging in, set textContentType and associated domains

Getting health authorization is now also supported on watchOS

Watch is now a standalone push target, you can send user-visible notifications and background notifications straight to the watch

New APNs request header – apns-push-type: set to alert for user-visible notifications, and background for background notifications

→ required for watchOS

Notification service extension support for e.g. decrypting notifications

Complication pushes can also be sent straight to the watch (PushKit)

Networking: use URLSession, CloudKit

  • make sure to use background sessions
  • full CKSubscription / CloudKit notifications support

It’s preferred to use URLSession than WatchConnectivity

  • WC is still available for any iOS-to-watchOS specific communication, but only use it if you really need to
  • check isCompanionAppInstalled