### Install Development Tools and Git Hooks Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/CONTRIBUTING.md Installs SwiftFormat and Tuist using mise, and sets up git hooks for the project. Ensure mise is installed first. ```bash # Install mise (if not already installed): https://mise.jdx.dev/getting-started.html mise install # Install git hooks ./Scripts/install-git-hooks.sh ``` -------------------------------- ### Install Mise and Dependencies Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/Example/README.md Installs Mise, adds it to zshrc, and then installs project dependencies using Mise. ```sh # install mise brew install mise # add mise activation line to your zshrc echo 'eval "$(mise activate zsh)"' >> ~/.zshrc # load mise into your shell source ~/.zshrc # tell mise to trust the config file mise trust # install dependencies mise install ``` -------------------------------- ### Install Tuist Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/Example/README.md Installs the Tuist dependency manager using a curl script. Verify the installation afterward. ```sh curl -Ls https://install.tuist.io | bash ``` -------------------------------- ### Install Tuist Project Dependencies Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/Example/README.md Installs project dependencies using Tuist. This command is typically needed for initial setup or after dependency changes. ```sh # only necessary for first setup or after changing dependencies tuist install --path Example ``` -------------------------------- ### Verify Xcode Installation Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/Example/README.md Use this command to check your current Xcode version and installation path. ```sh xcode-select -p ``` -------------------------------- ### Verify Tuist Installation Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/Example/README.md Checks if Tuist has been installed correctly by displaying its version. ```sh tuist version ``` -------------------------------- ### Open Xcode Workspace Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/Example/README.md Opens the generated Xcode workspace file to start development. ```sh open Example/AccessibilitySnapshot.xcworkspace ``` -------------------------------- ### Basic Accessibility Snapshot with SnapshotTesting Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/README.md Use the `.accessibilityImage` strategy with SnapshotTesting for basic accessibility snapshot tests. ```swift func testAccessibility() { let view = MyView() // Configure the view... assertSnapshot(matching: view, as: .accessibilityImage) } ``` -------------------------------- ### Customizing Activation Point Indicators with SnapshotTesting Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/README.md Control the display of accessibility activation point indicators per snapshot. Indicators are shown by default when the activation point differs from the default. ```swift func testAccessibility() { let view = MyView() // Configure the view... // Show indicators for every element. assertSnapshot(matching: view, as: .accessibilityImage(showActivationPoints: .always)) // Don't show any indicators. assertSnapshot(matching: view, as: .accessibilityImage(showActivationPoints: .never)) } ``` -------------------------------- ### Generate Xcode Project with Tuist Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/Example/README.md Generates the Xcode project and workspace for local development using Tuist. ```sh # generates and opens the Xcode project tuist generate --path Example ``` -------------------------------- ### Apache License 2.0 Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/README.md The Apache License, Version 2.0, governs the use of this software. It outlines permissions and limitations for using the code. ```text Copyright 2020 Square Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ``` -------------------------------- ### Customizing Activation Point Indicators with iOSSnapshotTestCase Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/README.md Control the display of accessibility activation point indicators per snapshot using `SnapshotVerifyAccessibility`. Indicators are shown by default when the activation point differs from the default. ```swift func testAccessibility() { let view = MyView() // Configure the view... // Show indicators for every element. SnapshotVerifyAccessibility(view, showActivationPoints: .always) // Don't show any indicators. SnapshotVerifyAccessibility(view, showActivationPoints: .never) } ``` -------------------------------- ### Basic Accessibility Snapshot with iOSSnapshotTestCase Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/README.md Use the `SnapshotVerifyAccessibility` method for basic accessibility snapshot tests with iOSSnapshotTestCase. ```swift func testAccessibility() { let view = MyView() // Configure the view... SnapshotVerifyAccessibility(view) } ``` -------------------------------- ### Add FBSnapshotTestCase+Accessibility Dependency (Swift Package Manager) Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/README.md Integrate AccessibilitySnapshot with iOSSnapshotTestCase for image comparisons by adding the FBSnapshotTestCase+Accessibility dependency to your test target. This is for Swift testing. ```swift targets: [ .target(name: "MyApp"), .testTarget(name: "MyAppTests", dependencies: ["MyApp", "FBSnapshotTestCase+Accessibility"]) ] ``` -------------------------------- ### Generate Xcode Project with Development Team Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/Example/README.md Generates the Xcode project while specifying a development team ID, useful for testing on hardware. ```sh TUIST_DEVELOPMENT_TEAM=ABCDEFG123 tuist generate --path Example ``` -------------------------------- ### Add AccessibilitySnapshotCore Dependency (Swift Package Manager) Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/README.md To use only the core accessibility parser without the full framework, add a dependency on AccessibilitySnapshotCore to your test target. This is useful for projects that only need the parsing capabilities. ```swift targets: [ .target(name: "MyApp"), .testTarget(name: "MyAppTests", dependencies: ["MyApp", "AccessibilitySnapshotCore"]) ] ``` -------------------------------- ### Add AccessibilitySnapshot Dependency (Swift Package Manager) Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/README.md Add AccessibilitySnapshot as a dependency to your project using Swift Package Manager by specifying the package URL and version. Ensure your test target includes AccessibilitySnapshot as a dependency. ```swift dependencies: [ .package(name: "AccessibilitySnapshot", url: "https://github.com/cashapp/AccessibilitySnapshot.git", from: "0.4.1"), ] ``` ```swift targets: [ .target(name: "MyApp"), .testTarget(name: "MyAppTests", dependencies: ["MyApp", "AccessibilitySnapshot"]) ] ``` -------------------------------- ### Accessibility Snapshot Test in Objective-C Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/README.md Perform accessibility snapshot tests from Objective-C using the `SnapshotVerifyAccessibility` function. ```objc - (void)testAccessibility; { UIView *view = [UIView new]; // Configure the view... SnapshotVerifyAccessibility(view, @"identifier"); } ``` -------------------------------- ### Accessibility Snapshot with Identifier using iOSSnapshotTestCase Source: https://github.com/cashapp/accessibilitysnapshot/blob/main/README.md Specify an identifier for the snapshot when using `SnapshotVerifyAccessibility` with iOSSnapshotTestCase. This is useful for distinguishing between multiple snapshots of the same view. ```swift func testAccessibility() { let view = MyView() // Configure the view... SnapshotVerifyAccessibility(view, identifier: "identifier") } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.