A Swift Package Manager (SPM) command plugin and CLI tool that scans your iOS Swift codebase for accessibility issues using BrowserStack’s Accessibility DevTools rule engine.
AccessibilityDevTools enables static accessibility linting directly inside Xcode, via SwiftPM, or using the standalone BrowserStack CLI, helping teams catch WCAG violations early—before UI tests, QA, or production.
- 🔍 Automatic static accessibility linting for SwiftUI
- 🛠 10+ WCAG-aligned rules from the Spectra rule engine
- 🛠 Inline errors inside Xcode with remediation guidance
- ⚡ Runs during build using the SPM command plugin
-
Log in to your BrowserStack account or sign up if you don’t have an account.
-
Obtain your Username and Access Key from the Account & Profile section section on the dashboard.

-
Set the following environment variables using the Username and Access Key you obtained in step 2.
BROWSERSTACK_USERNAMEBROWSERSTACK_ACCESS_KEY
-
To set these variables, add the appropriate export commands to your shell configuration file:
- Zsh: Add the following lines to your
~/.zshrcfile:
export BROWSERSTACK_USERNAME="<your-username>" export BROWSERSTACK_ACCESS_KEY="<your-access-key>"
- Bash: Add the following lines to your
~/.bashrcor~/.bash_profilefile:
export BROWSERSTACK_USERNAME="<your-username>" export BROWSERSTACK_ACCESS_KEY="<your-access-key>"
- Fish Shell: Add the following lines to your ~/.config/fish/config.fish file:
set -x BROWSERSTACK_USERNAME <your-username> set -x BROWSERSTACK_ACCESS_KEY <your-access-key>
- Zsh: Add the following lines to your
For SwiftPM projects, you can use the SPM command plugin for Accessibility DevTools.
Add plugin in your Package.swift
Edit the Project.swift to include following code. Specifically, these two things to be added
-
Add
AccessibilityDevToolsas a package under dependencies -
Add
a11y-scanas a plugin under each target that you have in your project
let package = Package(
name: "MySPMProject",
dependencies: [
.package(url: "https://github.com/browserstack/AccessibilityDevTools.git", from: "1.0.0")
],
targets: [
.executableTarget(
name: "MyApp",
dependencies: [],
plugins: [
.plugin(name: "a11y-scan", package: "AccessibilityDevTools")
]
)
]
)Add a Build Phase to run the plugin
- Select first item (project root) in the left folder tree and go to Build Phases tab

- Click + to create a new build phase. Name the newly created build phase to a name such as BrowserStack Accessibility Linter
- Drag this newly created build phase above Compile Sources step
- Delete any existing code in the newly created build step and add the following code.
- Add this script:
/usr/bin/xcrun swift package scan --disable-sandbox --include **/*.swiftXcode will now automatically run the accessibility scan during builds.
For all non-SwiftPM projects (e.g. Xcode projects), you can use the browserstack-cli
Install CLI in the project repo
- Open terminal and navigate to the project folder.
- Run the commands provided in the documentation
Disable Sandboxing
- In Xcode project, select first item (project root) in the left folder tree and go to Build Settings tab
- Search for sandbox > Set user script sandboxing to “NO”
Add a Build Phase to run the plugin
- Select first item (project root) in the left folder tree and go to Build Phases tab

- Click + to create a new build phase. Name the newly created build phase to a name such as BrowserStack Accessibility Linter
- Drag this newly created build phase above Compile Sources step
- Delete any existing code in the newly created build step and add the following code.
- Add this script:
./browserstack-cli accessibility --include **/*.swiftPress Cmd + B to build the project. If there are no errors from the linter (and any other build steps you have), the build will succeed.
If issues are found:
- Inline red markers show errors in files. Click on the cross mark to see the full error.

- All issues appear in the Issue Navigator

For any issues or feedback, reach out to support@browserstack.com