Build rich Augmented Reality experiences for iPhone, iPad and Mac.
DeepAR is an augmented reality SDK used to integrate advanced, Snapchat-like face lenses in iOS, Android and Web apps.
DeepAR iOS framework supports:
- Face filters and masks.
- Glasses virtual try on.
- Background replacement.
- Background blur.
- AR mini-games.
- iOS and iPad, minimum target version 12.4.
- MacOS, minimum target version 10.15.
DeepAR is available as xcframework for:
- iPhone simulator for x86_64 ARCH (arm64 support coming soon).
- Mac for x86_64 ARCH (arm64 support coming soon).
DeepAR can be used in both Swift and ObjC projects.
See the official example here.
Add swift package to your Xcode project from this GitHub URL:
To install DeepAR via CocoaPods, add this to your Podfile:
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.
- 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
Add Other...and then
- Select the
DeepAR.xcframeworkfrom the unzipped directory and click
In order to use the DeepAR SDK you need to set up a license key for your ios app on developer.deepar.ai.
- Create an account: https://developer.deepar.ai/signup.
- Create a project: https://developer.deepar.ai/projects.
- Add a ios app to the project. Note that you need to specify the bundle id of your app app.
Create DeepAR object and set your license key.
var deepAR = DeepAR()
Add delegate for the DeepAR object to be notified of async events.
deepAR.delegate = ...
Create CameraController object:
var cameraController = CameraController(deepAR: deepAR)
UIView that will display the camera preview and AR filters.
Add it to your view hierarchy.
let arView = self.deepAR.createARView(withFrame: ...)
Start the camera controller
Wait for the
didInitialize delegate to be called.
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: https://docs.deepar.ai/deep-ar-studio/free-filter-pack.
- Visit DeepAR asset store: https://www.store.deepar.ai/
- Create your own filters with DeepAR Studio.
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)
Please see: https://developer.deepar.ai/customer-agreement
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.