preface
App Clip (officially called “Light App” by Apple) is a lightweight version of your existing App that contains some of the features of your App. Think of it as a Lite version of your existing App.
App Clip is very small, the maximum size of the package before compression is less than 10 M, and it does not need to be downloaded from the App Store. Therefore, it can ensure timeliness. It is almost installed on the device at the same time that the App Clip is displayed. If you are desperate for users to access certain features, maybe App Clip will meet your needs.
The meanings of the nouns involved in this paper are agreed as follows:
App: An App is a fully functional application that is available on the App Store.
App Clip: Refers to the light application to be studied in this article.
Read this article and you will learn
-
What is App Clip?
-
What can App Clip do?
-
What can’t App Clip do?
-
How to let users find your App Clip?
-
How to develop an App Clip?
You can visit GitHub to obtain the accompanying Demo(github.com/yaoming88/A…).
What is APP Clip?
There are a lot of points to pay attention to in App Clip. In order to complete and accurate presentation and avoid distracting readers by hanging too many official documents, I have translated some official documents. If you already know, you can skip the “What is App Clip? Section goes directly to the coding section.
App Clip is an excellent way for users to quickly access and experience App features. App Clip is a small part of App functionality that can be taken and used as needed. App Clip uses lightweight files that run fast and are easy to open and use. Whether it’s ordering food from a restaurant, renting a car or setting up a new connected appliance for the first time, users can start and complete their experience with your App in seconds. After they play, you offer them the opportunity to download the full App from the App Store.
Part of the App
App Clip is a small part of the App, so you can develop it in the same Xcode project as the full App, using the iOS SDK. Also, because the App Clip is so small, it can be opened quickly even if it is not installed on the device. When it’s ready to submit for approval, you can manage it as part of the full App in App Store Connect.
Download the full App
App Clip provides an opportunity to quickly demonstrate the value of your App. To make it easier for users to get the full App, you can display the download option in App Clip when appropriate. You can even keep any information provided by the user and seamlessly transfer it to the full App.
Streamline design
App Clip focuses on completing a task quickly. In the ideal App Clip experience, users can start and complete a task in seconds. You can further streamline the experience by:
Support Apple Pay
Users are not required to provide credit card information, opting instead to make payments through Apple Pay.
This parameter is used with Log in through Apple
To make it easier to personalize the experience, App Clip allows you to log in to your App services using “Log in via Apple”, without requiring the user to fill out a form or set up a new account.
Take it when you need it
A key part of the App Clip experience is the discovery pathway:
App Clip code
The best way for users to discover App Clip. The App Clip code is beautiful and unique, and users will know that there is App Clip waiting for them to explore. Each App Clip code is programmed into a URL and can be added with AN NFC tag, which users can read with their phone or scan with their camera.
NFC tags
The user can activate the App Clip by simply holding the iPhone close to the NFC tag that you place in a specific position, even when the screen is locked.
Qr code
The QR code is placed in a specific position and the user scans the code using a barcode reader or “camera” App to activate the App Clip.
Safari App banner ads
If your web page is configured with smart App banner ads for App Clip, the user can open the App Clip by tapping on the banner.
Links in Information
If you enable sharing in App Clip, the user can send a link via iMessage message, and the person receiving the link can open it directly from the “message”.
Location information card in map
If your App Clip is associated with a specific location, you can register it on the location information card of the map so that the user can see and open the App Clip at that location.
App Clip recently used
App Clips are not cluttered on the home screen, but can be found and launched in the “Recently added” category of the new App repository.
8 hours notice
App Clip can use a new notification type that is presented to the user within 8 hours after the user launches your App Clip. Users tap on a notification and go straight back to your App Clip.
Position to verify
Apple has launched a location verification API that works with App Clip to help you verify that the actual position of the App Clip, NFC tag or QR code scanned by the user matches the displayed position. You only need to verify once.
Various App Clip experiences
Some apps offer multiple experiences, and you can configure the App Clip to support each experience in a special way. For example, a restaurant App can support multiple restaurants. App Clip supports creating unique experiences for each restaurant through a single App Clip.
Complete App experience
If the user has installed your App on the device, the App Clip code and App Clip link will open the App instead of the corresponding App Clip. Your App should process this link to provide the user with the same experience as the App Clip.
App Clip restrictions
App Clip is a lightweight version of App that provides some of its functionality whenever and wherever needed. It provides a focused set of features designed to launch immediately, protect user privacy, and protect resources. Therefore, App Clip has some limitations. Before creating App Clip, please check the Clip of the available technology (developer.apple.com/documentati App…
Make sure that the frame you are using works properly in App Clip
App Clip is developed using SwiftUI and UIKit and has access to the same framework as your full App. However, the following frameworks provide limited or no functionality at runtime: Assets Library, Background Tasks, CallKit, CareKit, CloudKit, Contacts, Contacts UI, Core Motion, EventKit, EventKit UI, File Provider, File Provider UI, HealthKit, HomeKit, Media Player, Messages, Message UI, PhotoKit, ResearchKit, SensorKit and Speech.
Protect user privacy
App Clip limits some permissions to protect user privacy and prevent users from tracking across applications and App Clips, for example:
- The functionality provided by SKAd is unavailable.
- App Clip cannot use App Tracking Transparency to track users.
- Name and identifierForVendor return an empty string.
- App Clip cannot request continuous position access. However, you can call requestAuthorization() to requestAuthorization, which will reset automatically at 4:00 am the next day.
- The App Clip cannot request the Pass Type IDs Entitlement to read the Pass stored in the wallet application. However, if your App Clip includes the ability to add a pass to the “wallet” App, you can check if the pass already exists. For more information, see Checking Whether a Pass Is in the Library.
- App Clip cannot share data with any application other than the corresponding full application. For more information, see Sharing Data Between Your App Clip and Your Full App.
App Clip also comes with restrictions that help protect user data. They do not have access to:
- Apple Music and media
- Data from applications such as calendars, contacts, files, health, messages, reminders and photos
- Sports and fitness data
In addition, you cannot use FaceID in your App Clip because NSFaceIDUsageDescription authorization is not available for App Clip. However, you can use the local authentication framework to authenticate users with Touch ID.
Note:
Your complete application can only have one App Clip, and the complete application must support all the functions of the App Clip.
coding
I believe that after reading the above content, you should have a clear idea of what App Clip is capable of. Next, let’s take a look at the code part of App Clip.
Create a Demo project
Create project:
Add a login module:
Operation effect:
Create an App Clip Target
App Clip is actually a target added to your existing project
It’s exactly the same
Write a few lines of code
Observe effect
Operation result of main project:
App Clip running effect:
We can see that the login page is perfectly reused without any modification by App Clip. The actual scene is slightly more complicated, and the three-way login entrance needs to be hidden.
App Clip Target Basic configuration
Configuring environment Variables
APPCLIP adds the environment variable APPCLIP to the Target App Clip to distinguish the current environment in which the shared code resides
Adapt according to environment variables
The shared code ADAPTS to the environment variable APPCLIP:
Associate App Clip with your website (Associated Domains)
The configuration is similar to supporting Universal Link and Web Credentials. The steps are as follows:
- Add Associated domains for App and App Clip targets
appclips:domain.com
.
- App Site Association on the Server (usually on the website
.well-known
Under theapple-app-site-association
File) for this domain nameappclips
Items:
{... "Appclips" : {/ / App Bundle of Clip Identifier "apps" : [" ABCED12345.com.example.MyApp.Clip "]}}Copy the code
If you are using Universal Link, just download the file (domain/apple-app-site-association), add the above configuration and ask the operation and maintenance students to help you put it in the specified location of the Server.
Note: When the user installs the corresponding App for the App Clip, the full App will replace the App Clip. From that point on, each call launches the full application instead of the App Clip. Therefore, you must associate the complete application with your website. In addition, the full application must handle all calls and provide the same functionality that App Clip provides.
Analyze the business you want to implement with App Clip
App Clip is designed to be installation-free and quick to start, so the package size is very limited. Please save limited functions for functions that can quickly attract users or critical services in a timely manner.
Module division (App and App Clip shared code extraction)
If you are not developing in modules, simply check the Clip target in the shared source file
It’s even easier if you use CocoaPods as a module, which you can rely on in the Clip in your Podfile.
Write functional code
Get the information carried by the URL
As with Universal Link, when App Clip is awakened, the App Clip’s UserActivity lifecycle method is called, which calls back based on the technology you are using:
SwiftUI: onContinueUserActivity(_: Perform:
Based on the Scene: the Scene (_ : willContinueUserActivityWithType:)
Based on the App Delegate: application (_ : continue: restorationHandler:)
Once you get the NSUserActivity, you can get the invoked URL via webpageURL.
The code distinguishes between APP environment and APP Clip environment
See “Configuring environment Variables” and “Adaptation based on environment Variables” above.
Development phase debugging
During the development phase, you can simulate the situation evoked by a specific URL by setting the _XCAppClipURL environment variable and running the AppClip target. When the Associated Domain is set correctly, run the App Clip in Xcode and get the NSUserActivity containing the environment value. This allows you to simulate real-world debugging.
Almost exactly as with native APP development, attention needs to be paid to how the information carried by the URL is retrieved when invoked.
Real machine test
Test your App Clip by configuring Local Experiences during the development test phase.
Configure App Clip experience on the real computer
Setting -> Developer -> APP CLIPS TESTING -> Local Experiences -> Register Local Experiences -> fill in the test information
Generate App Clip Code
You can generate App Clip Code using the App Clip Code Generator command-line tool or App Store Connect.
1. Download App Clip Code Generator and install it
2. Run the following command to generate App Clip Code
AppClipCodeGenerator generate --url https://appclip.example.com --index 9 --output ~/Desktop/filename.svg
Copy the code
We can see that an SVG file has been generated, see the official documentation for more details
Tip:
To create App Clip Code using App Store Connect, you first need to upload the App version that contains the App Clip and create an advanced App Clip experience. If you have not already done so – for example, during development – use the App Clip Code Generator command line tool instead.
Test the real experience
After completing the above Settings, you can experience your App Clip on the real machine.
- Camera scanning
- The phone is close to the NFC label
Data migration
When the user finishes downloading the App, the App Clip data will be automatically migrated to the complete App.
release
Submit the App to App Store Connect along with the main application, and correctly configure the App Clip experience according to the guidance.
conclusion
App Clip development belongs to iOS native development, which can use SwiftUI and UIKit, Swift and Objective-C. The development process is almost exactly the same as native development, and the learning cost is very small for iOS developers.
At present, the development prospect of App Clip in China is not clear. Fortunately, developing an App Clip will not take up too much resources. The key is code reuse.
Finally, we recommend an App Clip Shazam. Experience method: Turn on “Music Recognition” in the control center, and a notification banner will pop up when there is music playing around. Click the notification banner to open the App Clip and locate the identified song, which is practical and scientific.
reference
[^1][app-clips](developer.apple.com/app-clips)