---
title: "iOS accessibility audit with performAccessibilityAudit | Mobster"
description: "Apple's performAccessibilityAudit checks one screen per call. Here is its Swift call, then a CI audit of every screen your saved checks visit."
canonical: "https://mobster.dev/blog/ios-accessibility-audit"
last-updated: "2026-11-14"
---

Apple's performAccessibilityAudit checks one screen per call. Here is its Swift call, then a CI audit of every screen your saved checks visit.

# Check your iOS app's accessibility automatically in CI

30 October 2026

Apple’s `performAccessibilityAudit` finds accessibility issues from a UI test. Call it in your UI test after navigating to each screen you want to audit.

This post shows the Apple call first. Then you audit every screen a UI check visits without test code, and get a failed check in CI when the audit finds an issue.

## Audit one screen with XCTest

`performAccessibilityAudit(for:_:)` is a method on `XCUIApplication`, in Apple’s XCUIAutomation framework. Apple’s documentation lists it for iOS 17 and later. In [WWDC23’s session](https://developer.apple.com/videos/play/wwdc2023/10035/), Apple says it audits the current view the way the Inspector does, and that a test fails when it finds an issue, with no assertion needed:

```
func testAccessibility() throws {    let app = XCUIApplication()    app.launch()    try app.performAccessibilityAudit()}
```

The first parameter is an option set of audit types. Apple’s `XCUIAccessibilityAuditType` lists `action`, `contrast`, `dynamicType`, `elementDetection`, `hitRegion`, `parentChild`, `sufficientElementDescription`, `textClipped`, `trait` and `all`. The second parameter is a closure called for every issue. Return `true` to ignore an issue. By default nothing is ignored:

```
try app.performAccessibilityAudit(for: [.dynamicType, .contrast]) { issue in    // ignore a contrast issue on one label    if let element = issue.element,       element.label == "My Label",       issue.auditType == .contrast {        return true    }    return false}
```

That filter is the pattern from the session. An issue carries its `auditType`, `element`, `compactDescription` and `detailedDescription`.

Two limits come from Apple. The audit covers only the elements on screen, so “in order to provide complete coverage,” in Apple’s words, you add an audit test for each view. And audits “shouldn’t substitute real testing with assistive technologies,” which means a pass with VoiceOver and Dynamic Type turned on.

You maintain the navigation and audit calls as the app changes.

## Audit every screen a check visits with Mobster

[Mobster](https://mobster.dev/download) reads accessibility trees to check text and element assertions. `mobster test --audit a11y` audits those same trees. The audit calls no model and sends nothing off your Mac. A screen it has seen is audited once.

```
mobster test --audit a11y      # a finding fails its check
```

Turn on the audit in a check’s file with `audit: a11y`. Use `--audit a11y` to apply the audit to every check.

```
# .mobster/checks/checkout.yamlversion: 1name: Checkout reaches the confirmation screenapp:  bundle: com.yourname.yourappaudit: a11ysteps:  - Add the first item to the cart and tap Checkout.expect:  - text: Order confirmed
```

The audit rides on the steps you already wrote. A check that visits six screens audits six screens. It adds one tree read per step, about a second on a simulator. It cost 0.8 to 1.6 s a screen on an iOS Simulator.

### The rules

You get 4 rules in the Mobster audit, with the rule name in each finding:

- `control-no-label`: A button, switch, link, slider, stepper or text field with no label. A placeholder counts as a label for a text field. An identifier doesn’t, because VoiceOver doesn’t read it
- `image-no-label`: An image with no label that isn’t inside a labelled control
- `target-too-small`: A button, link or switch under 44 by 44 pt
- `text-clipped`: Only when the check sets `conditions.content_size` to `extra-large` or larger: text whose frame crosses the screen’s side edges or leaves its container

The two lists don’t match one to one. Run both if the difference matters to you.

## Fail CI on a finding

You get a failed check with `reason.class` of `finding` and exit code 1 when the audit finds an issue. In CI, write the JUnit file too:

```
mobster test --audit a11y --junit build/junit.xml
```

The next release adds four things. `mobster test --a11y` reports findings as warnings while your checks still pass. `mobster test --a11y --update-a11y-baseline` records findings in `.mobster/a11y-baseline.json`. `--a11y=strict` fails checks only on findings outside that file. And 3 more rules: `duplicate-label`, `label-unhelpful` and `unreachable-element`.

### What your CI reads

- **`junit.xml`:** You get 1 extra `<testcase>` per finding, named `<check>: <rule>, <element>`, with a `<failure type="accessibility">`. You also get a failure for the check’s own case, so you see both in the CI summary.
- **`results.json`:** each device result’s `findings` lists the rule, the guideline, the element with its `role`, `label`, `identifier` and `rect` in points, and the frame of the screen.
- **The HTML report:** You see each check’s findings on its page.

[Run iOS UI checks in CI without a device farm](https://mobster.dev/blog/ios-ui-checks-ci-no-device-farm) builds the workflow around this. The audit works the same on simulators and on a real iPhone with `--device`. Put `audit: a11y` in the checks you run with `mobster test pr` because that command doesn’t apply `--audit`.

## What an automated audit leaves out

- **Contrast.** Mobster doesn’t audit it. The accessibility tree has no colours, and the pixels under translucent bars, images and gradients don’t give a foreground and background you can trust. XCTest’s `.contrast` audit covers it.
- **VoiceOver.** Mobster reads the tree. It doesn’t drive VoiceOver or listen to what it says.
- **Dynamic Type in pixels.** `text-clipped` reads frames. Text that truncates inside a frame of the right size isn’t found, so a clean run isn’t proof that Dynamic Type works.
- **A person.** An audit finds a missing label. It doesn’t tell you whether the label, read aloud in order, makes sense. Run VoiceOver through your main flows before each release.

[Get Mobster for Mac](https://mobster.dev/download) and add `audit: a11y` to a check. The checks and the audit run on simulators and on your iPhone: [free](https://mobster.dev/pricing) on any number of iPhones (AI runs on a supported AI plan, an API key or a model on your Mac).

[Testing](https://docs.mobster.dev/testing#accessibility-audit) lists the flags, and [CI](https://docs.mobster.dev/ci) shows the JUnit file in GitHub Actions and GitLab. [Test your iOS app on a real iPhone with an AI agent](https://mobster.dev/blog/test-ios-app-real-iphone-ai-agent) covers writing the checks themselves.

## Questions

- ### What does performAccessibilityAudit check?
  It runs Apple's accessibility audit on the screen in front, the same categories as Xcode's Accessibility Inspector. The audit types are action, contrast, dynamicType, elementDetection, hitRegion, parentChild, sufficientElementDescription, textClipped and trait. It needs iOS 17 or later.
- ### Can I run an iOS accessibility audit in CI without writing test code?
  Yes. Use mobster test --audit a11y to audit each screen your saved checks visit and fail a check on a finding. It reads the accessibility tree, so you write no audit calls.
- ### How do I stop an accessibility audit from failing on old problems?
  In Mobster 0.4.0, fix the element or leave the audit off that check because every finding fails its check. In the next release, you record findings in .mobster/a11y-baseline.json with mobster test --a11y --update-a11y-baseline and use strict mode to fail checks only on findings outside that file.
- ### Does an automated audit replace testing with VoiceOver?
  No. Apple says audits shouldn't substitute for testing with assistive technologies like VoiceOver. An audit finds missing labels and small targets, and a person finds the screen that is confusing to hear.

## Sources

- [Apple: performAccessibilityAudit(for:_:)](https://developer.apple.com/documentation/xcuiautomation/xcuiapplication/performaccessibilityaudit(for:_:))
- [Apple: XCUIAccessibilityAuditType](https://developer.apple.com/documentation/xcuiautomation/xcuiaccessibilityaudittype)
- [Apple: XCUIAccessibilityAuditIssue](https://developer.apple.com/documentation/xcuiautomation/xcuiaccessibilityauditissue)
- [WWDC23: Perform accessibility audits for your app](https://developer.apple.com/videos/play/wwdc2023/10035/)
- [Mobster docs: accessibility audit](https://docs.mobster.dev/accessibility)
- [Mobster docs: run every check with mobster test](https://docs.mobster.dev/testing)
- [Mobster docs: running checks in CI](https://docs.mobster.dev/ci)

## Try it on your own iPhone

Download Mobster for Mac

## More from the blog

### [Run iOS UI checks in CI without a device farm](https://mobster.dev/blog/ios-ui-checks-ci-no-device-farm)

26 Oct 2026

### [Test your iOS app end to end on a real iPhone with an AI agent](https://mobster.dev/blog/test-ios-app-real-iphone-ai-agent)

27 Oct 2026

### [How to test an iOS app with an AI agent](https://mobster.dev/blog/ai-e2e-tests-ios-assertions)

8 Oct 2026
