App Clip can be said to be the most eye-catching of many sessions, adding a new product form to the Apple ecosystem. Admit it or not, the change App Clip will make when referees start kicking the ball off the pitch cannot be underestimated.
What are App Clips?
From the Apple Session description, we can understand the following: Users can invoke App Clip through NFC tag, QR code, Message Message, Map, Safari, Siri suggestion, etc., and use some services and functions in the main App in the form of webpage contact and native level experience without the main App installed.
App Clip is actually a URL in the Universal Link format, which Is processed by Apple at the system level. The App Clip URL, like the App, must be registered in App Store Connect.
PS: You can check the details if you are interestedWWDC20 Session 10146: Configure and link your app clips
Usage scenarios
Apple’s App Clip positioning is intended to further reach into all aspects of users’ lives, including low-frequency but necessary scenarios.
In some of the above scenarios, users often do not have the App specially serving the current scenario. If there is a program that is light enough and does not require installation, and enables users to access the services in the current scenario quickly and efficiently, wouldn’t it be easier to connect people and offline? That’s what App Clips is designed to do, to make people and offline services more accessible.
Take the example of ordering smoothies provided by Apple: Wake up the merchant App Clip through NFC, click open and start to buy.
How to wake up?
Apple has a very specific application scenario for App Clip, and the system has a strict filter on the launching mode. The following launching portals are supported:
- NFC
- QR Codes (also known as QR Codes, special generation tools will be available by the end of the year)
- Maps
- Siri advice
- Safari link
- Messages
The characteristics of
- Due to the size limit of 10M, it can be opened quickly for the current network status (domestic mobile network, all understand). Therefore, Apple uses “Open” instead of “Install” in the prompt of App Clip to reduce the acceptance level of users.
- In order to further improve the conversion from the App Clip to the main App, Apple will clearly indicate the existence of the main App during the application of the App Clip, so that users can directly download the App.
- If the device is not used for 30 days, the system automatically deletes App Clip and data to ensure proper storage space allocation.
- Support location, camera, microphone, bluetooth and other permissions, restrict access to Health, Fitness, address book, information, photos, files and other personal data.
- In order to avoid the bad experience of popup authorization, the notification and location permissions without application are designed. Of course, there are limitations. The waiver is only valid for eight hours, and the location can only be obtained once.
- Sign in with Apple is supported, too
ASWebAuthenticationSession
Log in to a third party and use Apple Pay.
- It does not appear together with App in the user’s Setting App, and has a separate group of App Clips.
- Once the main App is installed, the corresponding App Clip will be deleted, and click the link again to enter the main App directly.
implementation
Rely on the main App
Although there is no need for users to download the main App, the developer must submit the App Clip for review along with the main App. The App Clip cannot be independently developed and submitted for review. (This is consistent with Apple’s initial design philosophy, which is to quickly experience features, not replace apps.)
Independent of the Target
In terms of development, it is also a completely Native implementation, similar to a newly added Extension target, such as Keyboard Extension and iMessage Extension.
Support UIKit and SwiftUI
Some people think only SwiftUI development (including my leader) is actually wrong, Apple just said SwiftUI development will be faster (after all, the future flagship), you can directly see the test project:
App Clip not only supports SwiftUI, but also UIKit, including Objective-C, which many people still adhere to. There is no problem and there is no difficulty in getting started.
Data sharing
Since the Target is dependent on the main App, resource sharing between targets is completely OK. All you need to do is check App Clip on the resource attribution. Also, like Extension, App Clip can share data with the main App through App Groups.
Lead conversion
Apple suggests that developers embed SKOverlay in the App Clip view. When users complete relevant tasks in the App Clip, SKOverlay can be displayed to guide users. For example, it can be placed behind the user’s payment confirmation interface.
SKOverlay is also a New feature and will not be expanded here, see WWDC20 Session: What’s New with In-app Purchase for details.
Support one-to-many
At the same time, the main project supports multiple App Clip targets. At present, it is not clear what Apple’s limit on the number is, but it is estimated that it can meet the splitting of the main functions of most apps. Taking a certain group as an example, there can be multiple App Clips: bicycle, takeout, hotel accommodation, taxi, etc.
Support for different parameters
You only need to provide different parameters to provide different App Clip experiences according to different scenarios and requirements. For example, different cafes under the unified chain provided by the government can be taken as an example:
How to handle Universal Link and App Clip URL?
The solution provided by the official Demo is to do branching by compiling the macro APPCLIP, which maximizes code sharing:
import SwiftUI
#if APPCLIP
import AppClip
import CoreLocation
#endif
@main
struct FrutaApp: App {@StateObject private var model = FrutaModel(#)if !APPCLIP
@StateObject private var store = Store()
#endif
@SceneBuilder var body: some Scene {
WindowGroup{#if APPCLIP
NavigationView {
SmoothieMenu()
}
.environmentObject(model)
.onContinueUserActivity(NSUserActivityTypeBrowsingWeb, perform: handleUserActivity)
#else
ContentView()
.environmentObject(model)
.environmentObject(store)
#endif
}
}
#if APPCLIP
func handleUserActivity(_ userActivity: NSUserActivity) {
guard let incomingURL = userActivity.webpageURL,
let components = NSURLComponents(url: incomingURL, resolvingAgainstBaseURL: true),
let queryItems = components.queryItems else {
return
}
if let smoothieID = queryItems.first(where: {$0.name == "smoothie"})? .value { model.selectSmoothie(id: smoothieID) }guard let payload = userActivity.appClipActivationPayload,
let latitudeValue = queryItems.first(where: {$0.name == "latitude"})? .value,let longitudeValue = queryItems.first(where: {$0.name == "longitude"})? .value,let latitude = Double(latitudeValue), let longitude = Double(longitudeValue) else {
return
}
let region = CLCircularRegion(center: CLLocationCoordinate2D(latitude: latitude,
longitude: longitude), radius: 100, identifier: "smoothie_location")
payload.confirmAcquired(in: region) { inRegion, error in
if let error = error {
print(error.localizedDescription)
return
}
DispatchQueue.main.async {
model.applePayAllowed = inRegion
}
}
}
#endif
}
Copy the code
HandleUserActivity handles App Clip links.
Of course, it is also possible to separate the code of the main App and App Clip directly, but this may be more suitable for products that are quite different from the two. However, it also goes against Apple’s original intention that App Clip is only a part of the main App, which may lead to obstacles in the review.
Similarities and differences with small programs
Many we-media will compare the App Clip with the wechat mini program and think it is an Apple mini program. It is true that the App Clip is similar only from the initial design concept. However, in other respects, the two are quite different.
- The entrance is different: App Clip supports multiple opening methods, and wechat mini program can only be accessed from wechat, but the latter supports active search.
- The performance is different: App Clip depends on the system, while wechat applet depends on wechat. The native performance is significantly better than the applet.
- Different experience paths: You need to open wechat applets, pull down the list of applets, find and open the target applets, and the App Clip is in place in one step to implement dimension reduction attack.
- Different positioning: App Clip is clearly a part of the function of the main App and cannot be used for content irrelevant to the main App. However, micro App does not have this restriction and can be released independently.
Because of the different positioning, wechat applets can completely share the world with App Clip. Wechat applets have formed an ecosystem. Many domestic developers focus on the development of applets, and they do not have App, so App Clip is not used naturally. Still cannot shake the position of small program fundamentally.
Some questions to explore
Despite Apple’s fairly detailed description of App Clip, some questions remain unanswered:
- If App Clip not only provides quick functions, then pass
WKWebview
(Web Api can be used in App Clip) to show more content. Does Apple have any countermeasures? - Apple clearly limits the package size, but does not specify the memory. For example, The Memory management of the Keyboard is very strict, only tens of MEgabytes. If the App Clip adopts the same limitation, developers also need to pay attention to the problem of memory consumption.
Related to the Session
-
Explore app clips
-
Configure and link your app clips
-
Create app clips for other businesses
-
Streamline your app clip
-
Design great app clips
-
The official Demo
It’s not easy to create the article, any mistake, welcome to feng comment (Diao), please click on 👍, thank you very much!