Skip to content

Commit

Permalink
Improved DocC documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam-Spencer committed Dec 15, 2023
1 parent 2a349b2 commit 2f964d2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NukeSensitivity
iOS 17 Sensitive Content Analysis integration for [Nuke](https://github.com/kean/Nuke) written in swift.

NukeSensitivity makes it easy to detect and obscure sensitive content in images loaded and displayed with NukeUI.
iOS 17 Sensitive Content Analysis integration for [Nuke](https://github.com/kean/Nuke) written in swift. NukeSensitivity makes it easy to detect and obscure sensitive content in images loaded and displayed with NukeUI.

## Overview
Starting in iOS 17.0 and macOS 14.0, Apple provides a [Sensitive Content Analysis framework](https://developer.apple.com/documentation/sensitivecontentanalysis) for use in applications where users may want to hide potentially sensitive images and video. This library bridges Nuke -- the asynchronous image loading library -- and Apple's framework to make it easy to obfuscate content for users who opt-in.
Expand Down
22 changes: 22 additions & 0 deletions Sources/NukeSensitivity/Documentation.docc/AppIntegration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# App Integration and Testing

Configure your application entitlements and test devices to work with Sensitive Content Analysis.

## Overview

To properly use Apple's Sensitive Content Analysis framework, your application must include a special entitlement allowing it to call the system framework. Improper configuration by your application will result in the framework reporting that content analysis is `disabled`, whether it is or not, and rejecting any analysis requests.

Once the entitlement is added, your application becomes eligible to participate in sensitive content analysis. However, users maintain control over which applications have permission to do so.

To test analysis works as intended in your application, you'll need to do some additional setup as well.

### Add the entitlement

In Xcode, add `com.apple.developer.sensitivecontentanalysis.client` to your application's entitlements.

### Testing your application

1. Download the [testing profile from Apple](https://developer.apple.com/documentation/sensitivecontentanalysis/testing-your-app-s-response-to-sensitive-media#Install-the-test-profile) and install it on your test device. Once installed, the profile is valid for a period of three days. You'll need to download and re-install the profile if you need additional time for testing.
2. Pass `true` to the ``SensitiveContentShim/init(useFalsePositiveForDebug:)`` initializer in ``SensitiveContentShim``. When your app's `DEBUG` flag is set this will cause ``SensitiveContentShim`` to analyze the Apple-provided false-positive QR code instead of the provided image content. In configurations of your application where `DEBUG` is not set, this flag has no effect.
3. Enable Sensitive Content Analysis in your device's Privacy settings.
4. On the next run of your application, all images loaded with a ``SensitiveContentShim`` whose `useFalsePositiveForDebug` property set to `true` should be obscured. If this is not the case, check that you've set up your entitlements and testing profile correctly and that Sensitive Content Analysis is enabled specifically for your app.
7 changes: 6 additions & 1 deletion Sources/NukeSensitivity/Documentation.docc/Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ When a user who has opted-in to Sensitive Content Analysis (or has it enabled on

Before using this library, you'll need to do some additional setup in your application. Please read the <doc:GettingStarted> document to learn more.

## Comaptibility
## Compatibility
This library is compatible in projects targeting iOS 16 / macOS 13 and later. However, the Sensitive Content Analysis framework is only available on iOS 17.0 and macOS 14.0 and later. Use of the sensitive `LazyImage` initializers, `sensitiveOverlay`, and `SensitiveContentShim` have no effect on iOS / macOS versions prior to 17.0 / 14.0.

## Topics

### Setup, Integration, and Testing

- <doc:GettingStarted>
- <doc:AppIntegration>

### Loading Sensitive LazyImages

- ``NukeUI/LazyImage/init(url:sensitiveContentShim:)``
Expand Down

0 comments on commit 2f964d2

Please sign in to comment.