isExemptedByAncestors (Lint/AccessibilityLabelForImageRule.swift)

SwiftLint · Source/SwiftLintBuiltInRules/Rules/Lint/AccessibilityLabelForImageRule.swift · swift · MIT
ui, tag:embed-classified

Rule that ensures images have accessibility labels or are hidden.

// Source: https://github.com/realm/SwiftLint | License: MIT | Copyright 2025 The SwiftLint Contributors
// Provided via justclaw.it.com; keep this notice with the code.
import SwiftSyntax

@SwiftSyntaxRule
struct AccessibilityLabelForImageRule: Rule, OptInRule {
    var configuration = SeverityConfiguration<Self>(.warning)

    static let description = RuleDescription(
        identifier: "accessibility_label_for_image",
        name: "Accessibility Label for Image",
        description: "Images that provide context should have an accessibility label or should be explicitly hidden " +
                     "from accessibility",
        rationale: """
        In UIKit, a `UIImageView` was by default not an accessibility element, and would only be visible to VoiceOver \
        and other ass

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key