Skip to main content

iOS Native SDK

The PulpoAR iOS SDK brings Skin Analysis into your iOS app natively, with no WebView. It shows your project's questionnaire, a guided selfie and the result with the skin health score and your recommended products, styled with your Studio theme. Photos are analyzed on the device and never uploaded.

Before you start
  • The SDK is proprietary and needs an agreement with PulpoAR.
  • You need your project key (the project's slug) from PulpoAR Studio. The SDK uses it to load your questionnaire, products and theme.

Choose a module​

ModuleImportUse it when
PulpoSkinAIUI (recommended)import PulpoSkinAIUIYou want the complete skin analysis (questionnaire, guided selfie, result, recommended products and routines), styled with your Studio theme. One view. Includes PulpoSkinAIKit.
PulpoSkinAIKitimport PulpoSkinAIKitYou design your own screens. The Kit analyzes a photo on the device (skin health score, 12 concern scores, visuals), checks a live camera frame, and loads your project's questions and recommendations.

Requirements​

  • Xcode 26 or later
  • iOS 15.6 or later
  • A physical iPhone to test the camera (the simulator has no camera)

The frameworks include an arm64 device slice and arm64 and x86_64 simulator slices. The skin models are downloaded on first use and kept on the device.

1. Add the package​

Xcode: choose File → Add Package Dependencies…, enter https://github.com/pulpoar/pulpoar-ios-sdk, choose Up to Next Minor Version from 0.5.0, and add PulpoSkinAIUI to your app target. Below 1.0, a minor version can change the API.

Package.swift:

dependencies: [
.package(url: "https://github.com/pulpoar/pulpoar-ios-sdk", .upToNextMinor(from: "0.5.0"))
],
targets: [
.target(name: "YourApp", dependencies: [
.product(name: "PulpoSkinAIUI", package: "pulpoar-ios-sdk") // or "PulpoSkinAIKit"
])
]

The same package also has the Try-On modules. Add only the ones you need.

2. Allow the camera​

In your target's Info tab, add Privacy - Camera Usage Description (NSCameraUsageDescription). For example: "The camera takes the selfie for your skin analysis."

3. Show the skin analysis​

Analytics consent is required. Nothing is reported while it's .pending.

SwiftUI​

import PulpoSkinAIUI

PulpoSkinAIView(projectKey: "your-project", configuration: .init(
analyticsConsent: .pending,
onClose: { isSkinAIPresented = false }
))

UIKit​

let skinAI = PulpoSkinAIViewController(projectKey: "your-project", configuration: .init(
analyticsConsent: .pending,
onClose: { [weak self] in self?.dismiss(animated: true) }
))
skinAI.modalPresentationStyle = .fullScreen
present(skinAI, animated: true)

When the user answers your consent prompt, pass their answer:

PulpoSkinAIView.analyticsConsent = userAccepted ? .granted : .denied
warning

Never pass .granted without the user's consent.

4. Connect it to your app​

PulpoSkinAIView(projectKey: "your-project", configuration: .init(
analyticsConsent: .pending,
onProductTap: { product in openProductPage(product) }, // without it, the product's web page opens
onClose: { isSkinAIPresented = false },
onEvent: { event in
if case let .addToCart(products, _, _) = event { cart.add(products) }
}
))
OptionDescription
analyticsConsentRequired. .pending, .granted or .denied.
onProductTapCalled when a recommended product is tapped. Without it, the product's web page opens.
onCloseCalled when the close button is tapped. Dismiss the view here. Without it, there's no close button.
onEventCalled for each step of the flow, with the same events as the JavaScript SDK (event.key is the web event's name, such as onAddToCart). The UI has no cart: add the products on .addToCart. Called whatever the analytics consent.
onErrorCalled when loading the project or analyzing a photo fails. The UI shows the error itself.
localeForces a language: en, tr, pt, it, fr or ru. Otherwise it follows the device.

The products tab's add-all button is off by default. Turn it on in your Studio theme (result.withAddToCartAllProducts).

Building your own UI with the Kit​

Add PulpoSkinAIKit instead of PulpoSkinAIUI:

import PulpoSkinAIKit

let project = try await PulpoSkinAIProject.load(projectKey: "your-project")
let analyzer = PulpoSkinAnalyzer() // keep one while the feature is on screen
let analysis = try await analyzer.analyze(photo) // a few seconds, on the device
print(analysis.skinHealthScore, analysis.scores[.acne] ?? 0)
let recommendations = try await project.recommendations(for: analysis, answers: answerIds)

analyzer.checkFace(_:) checks a live camera frame (face direction, position, distance and light) to guide the user before the photo. analyzer.prepare() downloads the models ahead of the first analysis.

Resources​