Getting Started

Note: Extensive sample code can be found in the Xcode sample project.

Screenshot Screenshot Screenshot Screenshot

CocoaPods

CocoaPods is a dependency manager for iOS projects. To integrate PixelSDK into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'PixelSDK'

Then, run the following command:

$ pod install

Setup

Include the following lines in your application Info.plist:

<key>NSPhotoLibraryUsageDescription</key>
<string>Photo access is needed so you can select photos from your library.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access is needed so you can record video with sound.</string>
<key>NSCameraUsageDescription</key>
<string>Camera access is needed so you can take photos.</string>

Import PixelSDK into the file you are working on.

import PixelSDK

Present the SDK in response to a user action, for example, clicking a button. The default primary filters and adjustment filters will be used. The SDK will support both photo and video of any dimension with access to both the camera and library.

let container = ContainerController()
container.editControllerDelegate = self

let nav = UINavigationController(rootViewController: container)
nav.modalPresentationStyle = .fullScreen

self.present(nav, animated: true, completion: nil)

Also implement its delegate method. This delegate method will be called when the Next button in the EditController is pressed. In response you should either dismiss the UINavigationController or push a new controller on. The below example pushes a blank controller on. Then use the provided session parameter to export your photo or video at your own convenience.

extension ViewController: EditControllerDelegate {

    func editController(_ editController: EditController, didFinishEditing session: Session) {
        let controller = UIViewController()

        editController.navigationController?.pushViewController(controller, animated: true)
    }
}

Generate an API key and specify it in your application(_, didFinishLaunchingWithOptions:) of your App Delegate. The following pricing matrix applies to exports from your API key. Without an API key, image and video exports will include a watermark. Keep your API key private.

import PixelSDK

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

    PixelSDK.setup("YOUR API KEY")

    return true
}

Optionally, specify a maximum video duration. The default maximum video duration is 80 seconds.

 // Set the maximum video duration to 3 minutes.
 PixelSDK.shared.maxVideoDuration = 60*3

That’s it! You now have full access to the SDK.