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, first verify you have at least Xcode 11.4 or greater installed.

Then, ensure you have the latest version of CocoaPods installed by running the following command:

$ sudo gem install cocoapods

Specify PixelSDK in your Podfile:

pod 'PixelSDK'

Run the following command from within your project directory:

$ pod install

Swift Package Manager

Swift Package Manager is a dependency manager built into Xcode. To integrate PixelSDK into your Xcode project using Swift Package Manager, first verify you have the latest version of Xcode installed.

In the Xcode menu bar select File > Add Packages and enter the following repository URL into the search bar:

https://github.com/GottaYotta/PixelSDK.git

For Dependency Rule select Branch and master. Then press Add Package.

Note: We do not recommend setting the Dependency Rule to a major version because it will prevent you from receiving critical bug fixes in the future.

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>

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.

import PixelSDK
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 options are available for 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.