Wrapping device capabilities behind permission-aware iOS interfaces

← Back to Blog & Articles

The unit of work is one capability behind one protocol.

The durable artifact is a decision type with a test for every permission state and a platform adapter that is too small to need one. The chief hazard is state that must survive the process but does not.

Trace a photo: the user picks an image, the detail screen receives the data, the sanitizer produces a clean copy, the attachment store saves it, and an attach operation is queued in the outbox. Ownership is clear. The picker owns selection, the sanitizer owns privacy of the pixels, the store owns the file, and the outbox owns delivery.

Record the baseline with swift test --filter CapabilityTests. Add a locationWhenInUse feature in a scratch branch and watch PrivacyCheck report a missing purpose string. Add the string, the decision type, and the test for each permission state in separate commits.

Start from the sensitive files. Read the Info.plist diff first, then any entitlements, then the adapter, then the decision type. For each capability, ask what the user sees, what they can revoke, and what happens when they do.

When a device behaves differently from the simulator, check permission state, background limits, and low-power mode first. Reproduce with a fake that returns each state and add the case to the decision type’s tests.

Check that photos and attachments are sanitized before upload and deleted after, that attachment names cannot escape their directory, that no capability is declared without a use, and that nothing in a log or a notification payload carries location or customer content.

Test every permission state, including the ones the simulator rarely shows. Test background handlers with a recording scheduler and an outbox over an in-memory store. Test media code with real images that carry the property you claim to remove. On a device, test denial, revocation, airplane mode, and a force quit.

Treat capability changes as privacy changes. Require a named reviewer for Info.plist, entitlements, and privacy manifests, and ask for the user-facing reason in the pull request description.

  • Every permission state has a decision and a test.
  • A denied or restricted state never re-prompts.
  • Declared purpose strings match used capabilities.
  • Photos are sanitized and temporary files are deleted.
  • Background work rebuilds its state from disk.
  • Why does an undetermined permission ask only when the user starts the feature?
  • What would a vacuous sanitizer test look like, and how does this one avoid it?
  • Why does the background handler not reschedule after a conflict?
  • What do you lose by checking reachability instead of handling the failure?

Continue with the book

Explore the full treatment, worked examples, and exercises in Agentic iOS App Development.


Companion article for Agentic iOS App Development, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.

Scroll to Top