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
@@ -51,21 +51,22 @@ 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.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.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.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+
6667# ### 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”
68+ 1. In Xcode project , select first item (project root) in the left folder tree and go to Build Settings tab
69+ 2. Search for sandbox > Set user script sandboxing to “NO”
6970
7071# ### Add a Build Phase
7172Repeat these steps for each target in your project
@@ -75,10 +76,23 @@ Repeat these steps for each target in your project
7576! [Build Phase](./resources/build-phase.png " Build Phase" )
76773. Drag this newly created build phase above ** Compile Sources** step
77784. Delete any existing code in the newly created build step and add the following code
78- 5. Add this script:
79+ 5. Add this script, depending upon the shell you picked earlier:
80+
81+ Zsh
82+ ` ` ` zsh
83+ ./browserstack-a11y-scan-spm-zsh.sh --include ** /* .swift --non-strict
84+ ` ` `
85+
86+ Bash
87+ ` ` ` bash
88+ ./browserstack-a11y-scan-spm-bash.sh --include ** /* .swift --non-strict
7989` ` `
80- ./browserstack-a11y-scan-spm.sh --include ** /* .swift --non-strict
90+
91+ Fish
92+ ` ` ` bash
93+ ./browserstack-a11y-scan-spm-fish.sh --include ** /* .swift --non-strict
8194` ` `
95+
8296Xcode will now automatically run the accessibility scan during builds.
8397
8498# ## 2. Projects created with Swift package manager
@@ -120,22 +134,22 @@ Run the following command at the **root of your repository**
120134
121135Zsh
122136` ` ` 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
137+ 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
124138` ` `
125139
126140Bash
127141` ` ` 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
142+ 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
129143` ` `
130144
131145Fish
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
146+ ` ` ` bash
147+ 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
134148` ` `
135149
136150# ### 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”
151+ 1. In Xcode project , select first item (project root) in the left folder tree and go to Build Settings tab
152+ 2. Search for sandbox > Set user script sandboxing to “NO”
139153
140154# ### Add a Build Phase
141155Repeat these steps for each target in your project
@@ -145,10 +159,23 @@ Repeat these steps for each target in your project
145159! [Build Phase](./resources/build-phase.png " Build Phase" )
1461603. Drag this newly created build phase above ** Compile Sources** step
1471614. Delete any existing code in the newly created build step and add the following code.
148- 5. Add this script:
162+ 5. Add this script, depending upon the shell you picked earlier:
163+
164+ Zsh
165+ ` ` ` zsh
166+ ./browserstack-a11y-scan-spm-zsh.sh --include ** /* .swift --non-strict
167+ ` ` `
168+
169+ Bash
170+ ` ` ` bash
171+ ./browserstack-a11y-scan-spm-bash.sh --include ** /* .swift --non-strict
149172` ` `
150- ./browserstack-a11y-scan-spm.sh --include ** /* .swift --non-strict
173+
174+ Fish
175+ ` ` ` bash
176+ ./browserstack-a11y-scan-spm-fish.sh --include ** /* .swift --non-strict
151177` ` `
178+
152179Xcode will now automatically run the accessibility scan during builds.
153180
154181---
@@ -163,9 +190,22 @@ Press Cmd + B to build the project.
163190---
164191# # Register pre-commit hook
165192You can run accessibility checks automatically before each commit by running the following command.
193+
194+ Zsh
195+ ` ` ` zsh
196+ ./browserstack-a11y-scan-spm-zsh.sh register-pre-commit-hook
197+ ` ` `
198+
199+ Bash
166200` ` ` bash
167- ./browserstack-a11y-scan-spm.sh register-pre-commit-hook
201+ ./browserstack-a11y-scan-spm-bash .sh register-pre-commit-hook
168202` ` `
203+
204+ Fish
205+ ` ` ` bash
206+ ./browserstack-a11y-scan-spm-fish.sh register-pre-commit-hook
207+ ` ` `
208+
169209You can then edit the ` .git/hooks/pre-commit` file to customise the registered pre-commit hook.
170210
171211---
0 commit comments