Camera
PhotoEditor SDK offers a lightning fast camera implementation for iOS to complement your editor, featuring all essential camera components as well as live filters.
In order to use the camera, you have to instantiate a CameraViewController
and present it. You can configure the camera to suit your needs using the CameraViewControllerOptions
. To do so, you have to pass a Configuration
object to the CameraViewControllers
initializer. See the next section for a detailed example.
Warning: When adding a camera to your app, don't forget to set the required
NSCameraUsageDescription
andNSLocationWhenInUseUsageDescription
keys in theInfo.plist
file of your app. This is forced by iOS and allows your app to access the device's camera and location, which is needed to tag photos with their location. If you want to allow photo roll access, you'll have to set theNSPhotoLibraryUsageDescription
as well.
The options allow you to configure the available flash modes, a forced square crop, tap to focus, allowed flash modes and a bunch of other stuff. Furthermore, you may disable camera roll access or live filters. Presenting the default camera editor can be done using the following code:
let cameraViewController = CameraViewController()present(cameraViewController, animated: true, completion: nil)
A more complex configuration, e.g. a camera without flash and filters, and limited to the front camera, could be created like this:
let configuration = Configuration { builder inbuilder.configureCameraViewController { options in// Disable filtersoptions.showFilters = false// Force a selfie cameraoptions.allowedCameraPositions = [.front]// Disable flashoptions.allowedFlashModes = [.off]}}
For a complete example implementation please refer to the Show Camera example and to see our camera in action, check out our example app on the App Store .
Live filter preview#
The live filter preview allows your users to test different filters on the current image. The available filters may be configured using the AssetCatalog.effects
array, which is then passed to the Configuration
as described in the filters section or disabled as shown in the example above.