Requirements
Mobile iOS SDK requires iOS 14.0 or higher, Xcode 14.0 or higher, and Swift 5.0 or higher.
Let us know if want us to support older versions of iOS.
Installation
Mobile iOS SDK is available as a Swift Package at the official MetaKeep repository. To install it, add the package to your Xcode project.
Navigate to File > Add Packages
and enter the repository URL.
Then, select the dependency rule as Up to Next Major Version
and choose version 2.0.3
. Finally, click Add Package
and the SDK will be added as a dependency to your project.
Configure custom URL scheme
MetaKeep uses a custom URL scheme to send data back to your app after the user's operation.
Navigate to the Info tab
of your app target settings in XCode. In the URL Types
section, click the ļ¼
button to add a new URL. Enter the following values:
- Identifier: metakeep
- URL Schemes: $(PRODUCT_BUNDLE_IDENTIFIER)
Capture callback URL
Configure your app to handle the callback URL. The URL is invoked by MetaKeep after the user's operation. The URL contains the result of the operation.
To capture the callback URL, add the following code depending on the app UI lifecycle you are using:
import MetaKeep // import MetaKeep SDK
SomeView()
.onOpenURL { url in // Add onOpenURL handler.
MetaKeep.companion.resume(url: url.description) // Send callback to MetaKeep SDK
}
// SceneDelegate.swift
import MetaKeep // import MetaKeep SDK
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
guard let url = URLContexts.first?.url else { return }
MetaKeep.companion.resume(url: url.description) // Send callback to MetaKeep SDK
}
// AppDelegate.swift
import MetaKeep // import MetaKeep SDK
func application(_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool {
MetaKeep.companion.resume(url: url.description) // Send callback to MetaKeep SDK
return true
}
Ā© Copyright 2024, Passbird Research Inc.