11# AccessibilityDevTools
2- A Swift Package Manager (SPM) command plugin that scans your iOS Swift codebase for accessibility issues using BrowserStack’s Accessibility DevTools rule engine.
2+ 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.
33
4- AccessibilityDevTools enables static accessibility linting directly inside Xcode via SwiftPM, helping teams catch WCAG violations early—before UI tests, QA, or production.
4+ 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.
55
66---
77## 🚀 Key Capabilities
@@ -12,8 +12,8 @@ AccessibilityDevTools enables static accessibility linting directly inside Xcode
1212
1313---
1414## Supported projects types
15- 1 . Projects created with XCode
16- 2 . Projects created with Swift package manager
15+ 1 . Projects created with Swift package manager
16+ 2 . Projects created with XCode
1717
1818---
1919## Authentication
@@ -51,21 +51,18 @@ Run the following command at the **root of your repository**
5151
5252Zsh
5353` ` ` zsh
54- curl -L -o browserstack-a11y-scan-spm.sh " https://raw.githubusercontent.com/browserstack/AccessibilityDevTools/refs/heads/main/scripts/zsh/spm.sh" && chmod 0775 browserstack-a11y-scan-spm-zsh.sh
54+ curl -L -o browserstack-a11y-scan-spm-zsh .sh " https://raw.githubusercontent.com/browserstack/AccessibilityDevTools/refs/heads/main/scripts/zsh/spm.sh" && chmod 0775 browserstack-a11y-scan-spm-zsh.sh
5555` ` `
5656
5757Bash
5858` ` ` bash
59- curl -L -o browserstack-a11y-scan-spm.sh " https://raw.githubusercontent.com/browserstack/AccessibilityDevTools/refs/heads/main/scripts/bash/spm.sh" && chmod 0775 browserstack-a11y-scan-spm-bash.sh
59+ curl -L -o browserstack-a11y-scan-spm-bash .sh " https://raw.githubusercontent.com/browserstack/AccessibilityDevTools/refs/heads/main/scripts/bash/spm.sh" && chmod 0775 browserstack-a11y-scan-spm-bash.sh
6060` ` `
6161
6262Fish
63- ` ` ` fish
64- curl -L -o browserstack-a11y-scan-spm.sh " https://raw.githubusercontent.com/browserstack/AccessibilityDevTools/refs/heads/main/scripts/fish/spm.sh" && chmod 0775 browserstack-a11y-scan-spm-fish.sh
63+ ` ` ` bash
64+ curl -L -o browserstack-a11y-scan-spm-fish .sh " https://raw.githubusercontent.com/browserstack/AccessibilityDevTools/refs/heads/main/scripts/fish/spm.sh" && chmod 0775 browserstack-a11y-scan-spm-fish.sh
6565` ` `
66- # ### Disable Sandboxing
67- - In Xcode, select first item (project root) in the left folder tree and go to Build Settings tab
68- - Search for ` sandbox` > Set ` User script sandboxing` to “NO”
6966
7067# ### Add a Build Phase
7168Repeat these steps for each target in your project
@@ -75,10 +72,23 @@ Repeat these steps for each target in your project
7572! [Build Phase](./resources/build-phase.png " Build Phase" )
76733. Drag this newly created build phase above ** Compile Sources** step
77744. Delete any existing code in the newly created build step and add the following code
78- 5. Add this script:
75+ 5. Add this script, depending upon the shell you picked earlier:
76+
77+ Zsh
78+ ` ` ` zsh
79+ ./browserstack-a11y-scan-spm-zsh.sh --include ** /* .swift --non-strict
7980` ` `
80- ./browserstack-a11y-scan-spm.sh --include ** /* .swift --non-strict
81+
82+ Bash
83+ ` ` ` bash
84+ ./browserstack-a11y-scan-spm-bash.sh --include ** /* .swift --non-strict
85+ ` ` `
86+
87+ Fish
88+ ` ` ` bash
89+ ./browserstack-a11y-scan-spm-fish.sh --include ** /* .swift --non-strict
8190` ` `
91+
8292Xcode will now automatically run the accessibility scan during builds.
8393
8494# ## 2. Projects created with Swift package manager
@@ -120,23 +130,19 @@ Run the following command at the **root of your repository**
120130
121131Zsh
122132` ` ` zsh
123- curl -L -o browserstack-a11y-scan-spm.sh " https://raw.githubusercontent.com/browserstack/AccessibilityDevTools/refs/heads/main/scripts/zsh/spm.sh" && chmod 0775 browserstack-a11y-scan-spm.sh
133+ curl -L -o browserstack-a11y-scan-spm-zsh .sh " https://raw.githubusercontent.com/browserstack/AccessibilityDevTools/refs/heads/main/scripts/zsh/spm.sh" && chmod 0775 browserstack-a11y-scan-spm-zsh .sh
124134` ` `
125135
126136Bash
127137` ` ` bash
128- curl -L -o browserstack-a11y-scan-spm.sh " https://raw.githubusercontent.com/browserstack/AccessibilityDevTools/refs/heads/main/scripts/bash/spm.sh" && chmod 0775 browserstack-a11y-scan-spm.sh
138+ curl -L -o browserstack-a11y-scan-spm-bash .sh " https://raw.githubusercontent.com/browserstack/AccessibilityDevTools/refs/heads/main/scripts/bash/spm.sh" && chmod 0775 browserstack-a11y-scan-spm-bash .sh
129139` ` `
130140
131141Fish
132- ` ` ` fish
133- curl -L -o browserstack-a11y-scan-spm.sh " https://raw.githubusercontent.com/browserstack/AccessibilityDevTools/refs/heads/main/scripts/fish/spm.sh" && chmod 0775 browserstack-a11y-scan-spm.sh
142+ ` ` ` bash
143+ curl -L -o browserstack-a11y-scan-spm-fish .sh " https://raw.githubusercontent.com/browserstack/AccessibilityDevTools/refs/heads/main/scripts/fish/spm.sh" && chmod 0775 browserstack-a11y-scan-spm-fish .sh
134144` ` `
135145
136- # ### Disable Sandboxing
137- - In Xcode, select first item (project root) in the left folder tree and go to Build Settings tab
138- - Search for ` sandbox` > Set ` User script sandboxing` to “NO”
139-
140146# ### Add a Build Phase
141147Repeat these steps for each target in your project
142148
@@ -145,10 +151,23 @@ Repeat these steps for each target in your project
145151! [Build Phase](./resources/build-phase.png " Build Phase" )
1461523. Drag this newly created build phase above ** Compile Sources** step
1471534. Delete any existing code in the newly created build step and add the following code.
148- 5. Add this script:
154+ 5. Add this script, depending upon the shell you picked earlier:
155+
156+ Zsh
157+ ` ` ` zsh
158+ ./browserstack-a11y-scan-spm-zsh.sh --include ** /* .swift --non-strict
159+ ` ` `
160+
161+ Bash
162+ ` ` ` bash
163+ ./browserstack-a11y-scan-spm-bash.sh --include ** /* .swift --non-strict
149164` ` `
150- ./browserstack-a11y-scan-spm.sh --include ** /* .swift --non-strict
165+
166+ Fish
167+ ` ` ` bash
168+ ./browserstack-a11y-scan-spm-fish.sh --include ** /* .swift --non-strict
151169` ` `
170+
152171Xcode will now automatically run the accessibility scan during builds.
153172
154173---
@@ -163,9 +182,22 @@ Press Cmd + B to build the project.
163182---
164183# # Register pre-commit hook
165184You can run accessibility checks automatically before each commit by running the following command.
185+
186+ Zsh
187+ ` ` ` zsh
188+ ./browserstack-a11y-scan-spm-zsh.sh register-pre-commit-hook
189+ ` ` `
190+
191+ Bash
166192` ` ` bash
167- ./browserstack-a11y-scan-spm.sh register-pre-commit-hook
193+ ./browserstack-a11y-scan-spm-bash .sh register-pre-commit-hook
168194` ` `
195+
196+ Fish
197+ ` ` ` bash
198+ ./browserstack-a11y-scan-spm-fish.sh register-pre-commit-hook
199+ ` ` `
200+
169201You can then edit the ` .git/hooks/pre-commit` file to customise the registered pre-commit hook.
170202
171203---
0 commit comments