CameraKit Reference UI iOS
Overview
SCSDKCameraKitReferenceUI
is an optional SDK that provides reference UI elements similar to Snapchat’s UI as well as a fully-functional Camera view controller that has CameraKit set up and working with sample lenses. The elements provided in this SDK are designed to be used in a modular fashion, so it is easy to use certain UI elements out of the box while changing the design or functionality of other elements.
Usage Philosophy
In general, the UI elements in SCSDKCameraKitReferenceUI
are intended to be used out-of-the-box and they provide customizations to tailor the behavior slightly (eg. changing the recording duration of the camera button). The UI elements are also designed to be extended, changed, and used in a modular fashion – for example, using our carousel, camera button, and recorder together to record a video with a lens, but showing it in your own video preview view can easily be done using these elements out-of-the-box.
Getting Started
Requirements
SCSDKCameraKitReferenceUI
requires Swift, a minimum of iOS 11, and a 64 bit processor.
Dependency Management
CameraKit currently supports CocoaPods and Swift Package Manager.
CocoaPods
Add this line to your Podfile
:
pod 'SCSDKCameraKitReferenceUI', :path => 'CameraKit/CameraKitReferenceUI'
where :path
points to the directory that contains the camera kit sdk, podspec, etc.
Run pod install
and open up your xcworkspace
.
Swift Package Manager
- Drag and drop the
CameraKit/CameraKitReferenceUI
file into your project or workspace. - Click the + button in the “Frameworks, Libraries, and Embedded Content” section, select
SCSDKCameraKitReferenceUI
, and add it as a dependency.
More detail can be found in Apple’s documentation.
Showing the Camera
At its most simplest form, SCSDKCameraKitReferenceUI
contains a fully-setup camera that contains all UI elements (carousel, camera button, recorder, etc.) and hooks up to the core SCSDKCameraKit
sdk to fetch and apply lenses to the camera. This can be easily set up and presented by doing the following:
let cameraViewController = CameraViewController(repoGroups: ["5685839489138688"])
present(cameraViewController, animated: true, completion: nil)
where repoGroups
is the list of group IDs added in Lens Scheduler to show in the carousel.