MacKuba

🍎 Kuba Suder's blog on Mac & iOS development

WWDC 20

Streamline your app clip

Categories: App Clips, UIKit 0 comments Watch the video

(Watch the “Explore app clips” and “Configure and link your app clips” videos before.)

App clips are designed for speed of interaction – interaction needs to be focused on a specific goal and essential tasks

Leave any advanced or complex features for the main app

App clip should be usable immediately when launched

  • include any assets that will be needed immediately in the bundle
  • don’t add a splash screen
  • don’t ask people to log in or sign up before they can perform the task they want
  • ask for permission to access data only if it’s required and only at the moment when you need it

The main app should present the same experience in the same way

The app clip should have the same name and icon as the app

Organizing the project:

Keep in mind that the smaller the app clip bundle is, the faster your users can launch it, so only include what you really need in the bundle

Put shared assets in a separate shared asset catalog

Use Sign in with Apple, ASWebAuthenticationSession or password autofill for logging in

Consider giving an option to upgrade the account to Sign in with Apple if the user logs in using a password

App clips are ephemeral – users should be able to try them out easily while trusting that their privacy is being protected

Some user data is not accessible

You can ask for permission to camera, microphone and Bluetooth

Location access

Don’t ask for location access to determine which physical store the user is in – encode the store ID in the URL

To make sure they’re in the right store, you can use a new API to confirm the location that you already assume you know:

  • add NSAppClipRequestLocationConfirmation to NSAppClip dictionary in the Info.plist
  • get a payload object from userActivity.appClipActivationPayload
  • run payload.confirmAcquired(in: region) { … } (you can set a radius of up to 500m)

Notifications

Ephemeral notifications: you can ask for permission to send the user notifications up to 8 hours after the app clip is accessed

This does not show a regular popup asking for permission (user can refuse access in the initial app clip sheet)

Add NSAppClipRequestEphemeralUserNotification to the dictionary

When ephemeral access is granted, authorizationStatus in UNUserNotificationCenter will be set to .ephemeral

Migrating to the app

After the app clip is activated, a banner is shown at the top of the screen for a moment that leads you to the app’s page in the App Store

You can also use a new SKOverlay from StoreKit to show a popup recommending the app to the user

.appStoreOverlay() in SwiftUI

Do this after they finish the task

Passing data from the app clip to the app: use an app group container

You can also pass Sign in with Apple authorization:

  • get the user ID authorization.credential.user from the Sign in with Apple authorization success handler
  • save it as a file inside the group container (containerURL(forSecurityApplicationGroupIdentifier: “…”))
  • on the app side, read the file and pass it to ASAuthorizationAppleIDProvider: getCredentialState(forUserId: user)


Leave a comment

*

*
This will only be used to display your Gravatar image.

*

What's the name of the base class of all AppKit and UIKit classes?

*