Skip to content

Repository files navigation

swifta11y

Scans UIKit, SwiftUI, storyboard, and XIB code for missing accessibilityIdentifier values. Generates deterministic names, previews exact changes, and applies them strictly after a single Y/n confirmation.

Installation

Swift Package Manager (for programmatic integration)

dependencies: [
    .package(url: "https://github.com/PeachlifeAB/swifta11y.git", from: "0.1.0")
]

Add the IOSA11yInjectorCore product to your target.

Mint (for CLI usage)

mint install PeachlifeAB/swifta11y@0.1.0

Usage

Run from the root of your iOS project:

swifta11y .            # Scan, preview, and prompt Y/n
swifta11y . --preview  # Print change set without applying
swifta11y . --apply    # Force apply changes

(Optional) Create a .swifta11y YAML file in your root to restrict scope:

scan: [uikit, swiftui, xml]

Strict Naming Contract

This tool relies entirely on a deterministic, base-type-driven detection model (UIView / View). It does not use heuristics, file paths, or partial approvals.

  • Standard format: EnclosingType.propertyName (for example, LoginViewController.emailTextField)
  • Collections: EnclosingType.collectionName.viewName (for example, FeedView.items.titleLabel)
  • Strict skip rule: If an element lacks a stable, exact source-level name, it is skipped and excluded from auto-injection.

Testing & Architecture

  • Fast local tests: swift test --filter ProjectScanCountTests
  • Slow fixture scans: SWIFTA11Y_RUN_SLOW_FIXTURE_SCANS=1 swift test

About

Autoinject accessibility identifiers into your iOS project

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages