Getting started
As you follow this tutorial, we recommend using our demo project as a practical reference to assist you in integrating the SDK into your project.
Prerequisitesβ
Set up DeepAR accountβ
First thing you need to do is set up DeepAR account on our DeepAR developer portal. Developer portal is used to:
- Download DeepAR SDK.
- Access documentation and examples.
- Manage your projects and app license.
DeepAR License Keyβ
To deploy your DeepAR iOS/macOS apps it is required to use DeepAR license key.
π₯ DeepAR offers unlimited FREE licences for testing and small projects. π₯
- On developer portal, go to projects and click
+ New Project
. - Enter the name of your project. For example "My First AR App".
- Choose a FREE plan.
- Under
iOS App
ormacOS App
choose+ Add App
. - Enter the Bundle ID under which you plan to deploy your app.
Installβ
DeepAR is available as xcframework through CocoaPods, Swift Package Manager and can be downloaded directly from DeepAR Developer Portal.
Swift Packagesβ
Add swift package to your Xcode project from this GitHub URL:
https://github.com/DeepARSDK/swift-deepar
CocoaPodsβ
To install DeepAR via CocoaPods, add this to your Podfile:
pod 'DeepAR'
If the pod install
command fails, you may need to run pod install --repo-update
.
This is because the CocoaPods repos sometimes need a lot of time to sync.
Direct downloadβ
- Download the iOS package from DeepAR Developer Portal and unzip.
- With your project open in Xcode, select your Target. Under General tab, find Frameworks, Libraries, and Embedded Content and then click the
+
button. - Click
Add Other...
and thenAdd files...
button. - Select the
DeepAR.xcframework
from the unzipped directory and clickOpen
.
Getting startedβ
Import DeepAR.
import DeepAR
Create DeepAR object and set your license key.
var deepAR = DeepAR()
deepAR.setLicenseKey("your_license_key_here")
Add delegate for the DeepAR object to be notified of async events.
deepAR.delegate = ...
Create CameraController object:
var cameraController = CameraController(deepAR: deepAR)
Get the UIView
that will display the camera preview and AR filters.
Add it to your view hierarchy.
let arView = self.deepAR.createARView(withFrame: ...)
mainView.addSubview(arView)
Start the camera controller
cameraController.startCamera(withAudio: true)
Wait for the didInitialize
delegate to be called.
Switch effectsβ
AR filters are represented by effect files in DeepAR. You can load them to preview the effect.
Places you can get DeepAR effects:
- Download a free filter pack.
- Visit DeepAR asset store
- Create your own filters withΒ DeepAR Studio.
Call switchEffect
method to load an AR filter from a file.
File can be placed in the app bundle or fetched from network and saved to device.
deepAR.switchEffect(withSlot: "effect", path: path)
Licenseβ
Please see: https://developer.deepar.ai/customer-agreement
Permissionsβ
In the Info.plist file of your project, you need to add the following entries and their descriptions (the descriptions are optional):
Privacy - Photo Library Usage Description
Privacy - Microphone Usage Description
Privacy - Camera Usage Description
These are needed since the library uses camera features to take screenshot and videos which can be saved to your phone library. Additionally, to enable the sound processing features for recorded videos microphone usage description is required.