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.
-
Use this to access the shared instance of the
PixelSDK. For example to set the maxVideoDuration:PixelSDK.shared.maxVideoDuration = 20Declaration
Swift
public static let shared: PixelSDK
-
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
VideoExporterandImageExporterwill export with a watermark.Declaration
Swift
public class func setup(_ apiKey: String)Parameters
apiKeyYour API key.
-
The filters you provide here will be made available under the Filter tab of the
EditControllerand are also available on theCameraController. 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:
defaultStandardFiltersWarning
Repeating filters of the same type will result in undocumented behavior.Declaration
Swift
public lazy var primaryFilters: [SessionFilter] { get set } -
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 lazy var adjustmentFilters: [SessionFilter] { get set }
-
The default standard filters. Should only be used with the
primaryFiltersvariable.Default value:
[ SessionFilterWilshire(), SessionFilterMontana(), SessionFilterSanVicente(), SessionFilterMelrose(), SessionFilterSepulveda(), SessionFilterLaCienega(), SessionFilterAbbotKinney(), SessionFilterMulholland(), SessionFilterSunset() ]Declaration
Swift
public static let defaultStandardFilters: [SessionFilter] -
The default visual effect filters. Should only be used with the
primaryFiltersvariable.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]
-
The apiKey that was provided when calling
setup(apiKey:).Default value:
nilDeclaration
Swift
public var apiKey: String? { get } -
The maximum allowed video duration in seconds. This duration is only enforced by UI components.
The
CameraControllerwill end recording when the maxVideoDuration has been reached.The
EditControllerwill 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:
80Declaration
Swift
public var maxVideoDuration: Int -
If you want to force the SDK to use a specific language and not the language provided by the system you can provide a language code here. The language code must come directly from the list of supported languages.
For example Simplified Chinese:
PixelSDK.shared.languageCode = "zh-Hans"Default value:
nilDeclaration
Swift
public var languageCode: String? { get set }
View on GitHub
PixelSDK Class Reference