GETTING STARTED / Quickstart
Quickstart.
Add AntiNude to your iOS or Android app in under 10 minutes. The model runs entirely on-device — no images leave the user's phone.
§01 / INSTALL
Install the SDK.
Package.swift · SPMcopy
1dependencies: [
2 .package(url: "https://github.com/AntiNude/an-sdk-ios.git", from: "0.9.0"),
3]
§02 / INIT
Initialize an ANClient.
Construct an ANClient with your API key. Do this once per process — the model loads on construction.
Swiftcopy
1import ANSdk
2
3let client = try ANClient(apiKey: "ak_live_…")
4// Model loads lazily on first scan (~30 ms).
§03 / SCAN
Run your first scan.
Swiftcopy
1let data = try Data(contentsOf: imageURL)
2let result = try await client.scanImage(data)
3
4if result.verdict == "unsafe" {
5 // top class, e.g. "FEMALE_BREAST_EXPOSED" + score 0.94
6 reportToModeration(result.topCategory, result.topScore)
7} else {
8 showImage(data)
9}
[!]
Default verdict rule (hardcoded).
The SDK marks a scan unsafe if any of the five “exposed” classes (female breast / genitalia, male genitalia, buttocks, anus) scores above 0.50. To customise this — e.g. block at a lower score, or treat a different subset as unsafe — inspect
result.detections yourself. See Custom verdict rules.§04 / RESPONSE
What you get back.
| FIELD | TYPE | EXAMPLE | NOTES |
|---|---|---|---|
| verdict | String | "safe" / "unsafe" | Derived from detections |
| topCategory | String? | "FEMALE_BREAST_EXPOSED" | Highest-scoring class, if any |
| topScore | Double? | 0.94 | 0.0–1.0 · confidence of the top detection |
| detections | [Detection]? | […] | All detections incl. bbox (on-device only) |
| latencyMs | Int | 47 | Wall-clock on-device |
| modelVersion | String | "nudenet-320n-v3.4" | Pinned per SDK release |
| requestId | String? | "req_9af2…" | nil if reportToServer=false or telemetry failed |