PixelSDK

@objcMembers
public class PixelSDK

Use this class to initialize the SDK from your App Delegate. For example:

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

   PixelSDK.setup("YOUR API KEY")

   return true
}

An API key can be generated here. Keep your API key private.

If you do not provide an API key or it is invalid, the VideoExporter and ImageExporter will export with a watermark.

Additionally, this class is used for global settings like primaryFilters. Further SDK customization is handled by individual controllers and sessions.

Getting the Shared PixelSDK

  • Use this to access the shared instance of the PixelSDK. For example to set the maxVideoDuration:

    PixelSDK.shared.maxVideoDuration = 20
    

    Declaration

    Swift

    public static let shared: PixelSDK

Initialization

  • You must call this in the application(_, didFinishLaunchingWithOptions:) of your App Delegate. You can retrieve an API key by signing up here. Do not share your API key.

    If you do not provide an API key or it is invalid, the VideoExporter and ImageExporter will export with a watermark.

    Declaration

    Swift

    public class func setup(_ apiKey: String)

    Parameters

    apiKey

    Your API key.

Setting Custom Filters

  • The filters you provide here will be made available under the Filter tab of the EditController and are also available on the CameraController. Set this to an array of freshly allocated SessionFilters.

    For example:

    PixelSDK.shared.primaryFilters = [
        SessionFilterWilshire(),
        SessionFilterMontana(),
        SessionFilterSanVicente(),
        SessionFilterMelrose(),
        SessionFilterSepulveda(),
        SessionFilterLaCienega(),
        SessionFilterAbbotKinney(),
        SessionFilterMulholland(),
        SessionFilterSunset()
    ]
    

    Default value: defaultInstaFilters

    Warning

    Repeating filters of the same type will result in undocumented behavior.

    Declaration

    Swift

    public var primaryFilters: [SessionFilter]
  • The filters you provide here will be made available on the Adjust tab of the EditController. Set this to an array of freshly allocated SessionFilters.

    Default value:

    [
        SessionFilterSpeed(),
        SessionFilterBrightness(),
        SessionFilterSaturation(),
        SessionFilterVibrance(),
        SessionFilterContrast(),
        SessionFilterExposure(),
        SessionFilterHue(),
        SessionFilterWarmth(),
        SessionFilterSharpness(),
        SessionFilterGamma(),
        SessionFilterHighlights(),
        SessionFilterShadows(),
        SessionFilterVignette()
    ]
    

    Warning

    Repeating filters of the same type will result in undocumented behavior.

    Declaration

    Swift

    public var adjustmentFilters: [SessionFilter]

Default Primary Filters

  • The default insta filters. Should only be used with the primaryFilters variable.

    Default value:

    [
        SessionFilterWilshire(),
        SessionFilterMontana(),
        SessionFilterSanVicente(),
        SessionFilterMelrose(),
        SessionFilterSepulveda(),
        SessionFilterLaCienega(),
        SessionFilterAbbotKinney(),
        SessionFilterMulholland(),
        SessionFilterSunset()
    ]
    

    Declaration

    Swift

    public static let defaultInstaFilters: [SessionFilter]
  • The default visual effect filters. Should only be used with the primaryFilters variable.

    Default value:

    [
        SessionFilterPixellate(),
        SessionFilterFalseColor(),
        SessionFilterLuminanceThreshold(),
        SessionFilterSketch(),
        SessionFilterPolkaDot(),
        SessionFilterHalftone(),
        SessionFilterSepiaTone(),
        SessionFilterToon(),
        SessionFilterTiltShift(),
        SessionFilterSwirl(),
        SessionFilterBulge(),
        SessionFilterCGAColorspace(),
        SessionFilterPinch(),
        SessionFilterEdgeDetection(),
        SessionFilterSphereRefraction(),
        SessionFilterGaussianBlur(),
        SessionFilterStretchDistortion()
    ]
    

    Declaration

    Swift

    public static let defaultVisualEffectFilters: [SessionFilter]

Properties

  • The apiKey that was provided when calling setup(apiKey:).

    Default value: nil

    Declaration

    Swift

    public var apiKey: String? { get }
  • The maximum allowed video duration in seconds. This duration is only enforced by UI components.

    The CameraController will end recording when the maxVideoDuration has been reached.

    The EditController will warn when trimming a video if the maxVideoDuration has been reached e.g. “7:15 Over” and if next is pressed it will alert and require the user further trim the video.

    The default value for this may change in the future, so we recommend you set this to your preferred max video duration.

    Default value: 80

    Declaration

    Swift

    public var maxVideoDuration: Int

Deprecated

  • Declaration

    Swift

    @available(*, deprecated, renamed: "primaryFilters")
    public var availablePrimaryFilters: () -> [SessionFilter] { get set }
  • Declaration

    Swift

    @available(*, deprecated, renamed: "adjustmentFilters")
    public var availableAdjustFilters: () -> [SessionFilter] { get set }
  • Declaration

    Swift

    @available(*, deprecated, renamed: "defaultInstaFilters")
    public static var instaFilters: () -> [SessionFilter] { get }
  • Declaration

    Swift

    @available(*, deprecated, renamed: "defaultVisualEffectFilters")
    public static var visualEffectFilters: () -> [SessionFilter] { get }