iOS API Reference
Complete class and method reference for the Perfectly Clear iOS SDK
This page documents all public classes and methods in PFC_iOS_Framework.xcframework. The API is written in Objective-C and is fully accessible from Swift.
PCSEngine
The core image processing engine. Wraps the Perfectly Clear C++ engine and exposes scene detection, correction, and creative look operations.
class PCSEngine: NSObjectPCSEngine is not thread-safe. Serialize all calls using an NSLock or similar mechanism. Create one engine instance per workflow; switching workflows requires constructing a new instance.
Constructor
init(
apiKey: String,
certificate: String,
sceneDetectionModelUrL: URL,
skintoneModelUrl: URL,
aiColorModelUrl: URL,
aiFDFrontModel: URL,
aiFDBackModel: URL,
aiFacemeshModel: URL,
aiBlendshapeModel: URL,
scenePresetsUrl: URL?,
addonLooksUrl: URL
)Parameters:
| Parameter | Description |
|---|---|
apiKey | API key string provided by EyeQ |
certificate | Certificate string provided by EyeQ |
sceneDetectionModelUrL | Path to the scene detection .pnn model file |
skintoneModelUrl | Path to the skin tone .pnn model file |
aiColorModelUrl | Path to the AI color correction .pnn model file |
aiFDFrontModel | Path to the front face detection .pnn model file |
aiFDBackModel | Path to the back face detection .pnn model file |
aiFacemeshModel | Path to the face mesh .pnn model file |
aiBlendshapeModel | Path to the face blend-shape .pnn model file |
scenePresetsUrl | Path to the scene preset file (.preset); nil for School & Sports workflow |
addonLooksUrl | Path to the creative looks bundle (.looks) |
Properties
| Property | Type | Description |
|---|---|---|
pfcEngine | UnsafeMutableRawPointer | Internal C++ engine pointer; do not access directly |
automapSceneLabels | Bool | When true, the engine maps raw model labels to canonical scene IDs |
sceneMappings | [Any] | Read-only array of scene label mapping entries |
Methods
detectSceneForImage
Classifies the image using on-device AI models and returns the detected scene and a color profile.
func detectSceneForImage(_ image: PCSImage) -> PCSSceneDetectionResult?Returns nil if detection fails (missing models, incompatible image format, or engine error). Run on a background thread — blocks for the full classification pass.
applyParam
Applies correction parameters to an image using a previously computed color profile.
func applyParam(
_ param: PCSParam,
toImage image: PCSImage,
profile: PCSProfile?,
errorCode: UnsafeMutablePointer<Int32>
) -> PCSParamParameters:
| Parameter | Description |
|---|---|
param | Correction parameters — pass a copy (param.copy() as! PCSParam) |
image | The PCSImage to correct, must be on the same thread it was created |
profile | Color profile from detectSceneForImage; pass nil to skip profile-based correction |
errorCode | On return, 0 indicates success |
Returns the param that was actually applied (may differ from the input if the SDK computed auto values).
calcFromImage
Computes the image profile without applying corrections. Use when you want to call applyParam multiple times with different parameters on the same image.
func calcFromImage(_ pcsImage: PCSImage) -> PCSProfilegetSceneDescriptions
Returns the list of scenes available in the loaded preset model.
func getSceneDescriptions() -> [PCSSceneDescription]getLooks3DLutWithGuid
Returns the LUT data for a creative look identified by its GUID.
func getLooks3DLutWithGuid(
_ guid: String,
strength: Int32,
contrast: Int32,
saturation: Int32
) -> UnsafeMutablePointer<Float>?PCSImage
An image wrapper that holds pixel data in the format required by PCSEngine. Created from a UIImage and used as both input and output for the engine.
class PCSImage: NSObjectPCSImage is thread-affine. Create it and consume it on the same thread. Do not create a PCSImage on the main thread and then pass it to a background queue.
Constructor
init?(image: UIImage)Returns nil if the UIImage does not meet the SDK's format requirements. The image must be:
- 8 bits per component
- 32 bits per pixel
- sRGB color space
bitmapInforaw value16385(alphaFirst | byteOrder32Big)
Always re-render through UIGraphicsImageRenderer(preferredRange: .standard) before passing to this constructor.
Properties
| Property | Type | Description |
|---|---|---|
width | Int32 | Image width in pixels |
height | Int32 | Image height in pixels |
stride | Int32 | Bytes per row (should equal width × 4) |
bitsPerComponent | Int32 | Must be 8 |
bitsPerPixel | Int32 | Must be 32 |
bytesPerPixel | Int32 | Must be 4 |
bitmapInfo | CGBitmapInfo | Raw value must be 16385 |
colorSpace | CGColorSpace | Must be sRGB |
data | UnsafeMutablePointer<UInt8> | Raw pixel bytes |
pfcImage | UnsafeMutableRawPointer | Internal image pointer; do not access directly |
Methods
generateImage
Extracts the processed image after applyParam has been called. Returns a new UIImage with corrections applied.
func generateImage(withColorSpace colorSpace: CGColorSpace) -> UIImageCall this on the same thread where the PCSImage was created, immediately after applyParam.
PCSParam
Holds all correction parameters. Passed to applyParam to control the correction result.
class PCSParam: NSObject, NSCopyingThe default initializer PCSParam() represents the identity state — no corrections applied. Use this to reset all parameters.
Initializers
// Identity (no correction)
init()
// Scene-optimized parameters from a detected scene
init(sceneLabel: Int, usingEngine engine: PCSEngine)Instance methods
// Returns a new param with all values scaled by the given strength (0–100+)
func withStrength(_ strength: Int) -> PCSParam
// NSCopying — always copy before passing to applyParam
func copy(with zone: NSZone? = nil) -> AnyCorrection parameters
Overall strength
| Property | Type | Description |
|---|---|---|
iStrength | Int | Overall correction strength (0–100+) |
bUseAutomaticStrengthSelection | Bool | Let the SDK select optimal strength |
iSkintoneType | Int | Skin tone category (1–10) |
Dynamic and white balance
| Property | Type | Description |
|---|---|---|
iDynamic | Int | Dynamic range correction amount |
iDynamicWB | Int | Dynamic white balance amount |
Skin tools
| Property | Type | Description |
|---|---|---|
bSmooth | Bool | Enable skin smoothing |
iSmoothLevel | Int | Skin smoothing amount |
bSkinToning | Bool | Enable skin tone normalization |
iSkinToning | Int | Skin toning amount |
bBlush | Bool | Enable blush enhancement |
iBlush | Int | Blush amount |
Eye tools
| Property | Type | Description |
|---|---|---|
bEyeCirc | Bool | Enable eye circle reduction |
iEyeCirc | Int | Eye circle reduction amount |
bCatchLight | Bool | Enable catchlight enhancement |
iCatchLight | Int | Catchlight enhancement amount |
Face tools
| Property | Type | Description |
|---|---|---|
bTeeth | Bool | Enable teeth whitening |
iTeethLevel | Int | Teeth whitening amount |
bLipSharpen | Bool | Enable lip sharpening |
iLipSharpen | Int | Lip sharpening amount |
bSlim | Bool | Enable face slimming |
iSlim | Int | Face slimming amount |
Portrait light
| Property | Type | Description |
|---|---|---|
bPortraitLight | Bool | Enable portrait light effect |
iPortraitLight | Int | Portrait light amount |
iPortraitLightDepth | Int | Portrait light depth |
iPortraitLightFeather | Int | Portrait light feather |
Color
| Property | Type | Description |
|---|---|---|
iColorVibrancy | Int | Color vibrancy |
iContrast | Int | Contrast |
iLocalContrast | Int | Local contrast |
iVibrancy | Int | Vibrancy |
Finishing tools
| Property | Type | Description |
|---|---|---|
iFinishTemp | Int | Finishing temperature |
iFinishTint | Int | Finishing tint |
iFinishExposure | Int | Finishing exposure |
Creative looks (LUT)
| Property | Type | Description |
|---|---|---|
lutOutputGuid | String? | GUID of the creative look to apply; nil for no look |
lutOutputStrength | Int | Look strength (0–100) |
iOutLUTcontrast | Int | Look contrast adjustment |
iOutLUTsaturation | Int | Look saturation adjustment |
PCSProfile
An opaque color profile returned by detectSceneForImage. Encodes the scene-specific color characteristics needed during applyParam.
class PCSProfile: NSObjectProperties
| Property | Type | Description |
|---|---|---|
pfcProfile | UnsafeMutableRawPointer | Internal profile pointer; do not access directly |
A PCSProfile is tied to the PCSEngine that created it. Do not cache profiles across engine replacements (workflow switches). After switching workflows, run detectSceneForImage again to obtain a fresh profile from the new engine.
PCSSceneDetectionResult
Return value of PCSEngine.detectSceneForImage. Carries both the scene classification result and the color profile needed for applying corrections.
class PCSSceneDetectionResult: NSObjectProperties
| Property | Type | Description |
|---|---|---|
sceneLabel | Int | Canonical scene identifier (see scene catalogue in Using the SDK) |
unmappedSceneLabel | Int | Raw label from the model before canonical mapping |
profile | PCSProfile | Color profile — pass directly to applyParam for the same image |
PCSSceneDescription
Describes a single scene available in the loaded preset model. Returned by PCSEngine.getSceneDescriptions().
class PCSSceneDescription: NSObjectProperties
| Property | Type | Description |
|---|---|---|
sceneLabel | Int | Scene identifier |
localizationKey | String | Localization key for the scene name |
imageName | String | Asset name for the scene thumbnail |