All skills
dpearson2699 avatar

/ios-accessibility

@45c9085

Build and audit SwiftUI, UIKit, and AppKit accessibility for VoiceOver, Voice Control, Switch Control, Full Keyboard Access, Dynamic Type, focus restoration, labels/traits/actions, traversal, custom rotors, NSAccessibility, XCTest checks, adaptive system preferences, and App Store accessibility declarations. Use when implementing accessible UI, fixing an accessibility audit, testing assistive-technology behavior, or substantiating App Store Accessibility Nutrition Labels.

Use this Skill: https://skilld.dev/gh/dpearson2699/swift-ios-skills/ios-accessibility

This session only. Nothing lands on disk.

referencesmedia-accessibility.md

≈886 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Media Accessibility

Accessibility patterns for audio and video content using AVFoundation.

Contents

Closed Captions and Subtitles

AVMediaCharacteristic Tags

AVFoundation uses media characteristics to identify accessibility tracks:

Docs: AVMediaCharacteristic

Characteristic Purpose
.transcribesSpokenDialogForAccessibility Captions/SDH — transcribes dialog for deaf or hard of hearing users
.describesMusicAndSoundForAccessibility Captions that include descriptions of music and sound effects
.describesVideoForAccessibility Audio descriptions — narrates visual content for blind or low-vision users
.easyToRead Simplified captions for cognitive accessibility
.containsOnlyForcedSubtitles Subtitles that display only when content differs from the device language
.languageTranslation Subtitles providing a language translation

Selecting Accessible Media

import AVFoundation

let asset = AVURLAsset(url: videoURL)
let group = try await asset.load(.mediaSelectionGroup(forMediaCharacteristic: .legible))

if let group {
    // Find the closed caption option
    let ccOptions = AVMediaSelectionGroup.mediaSelectionOptions(
        from: group.options,
        with: .transcribesSpokenDialogForAccessibility
    )

    if let ccOption = ccOptions.first {
        let playerItem = AVPlayerItem(asset: asset)
        playerItem.select(ccOption, in: group)
    }
}

Audio Descriptions

let adGroup = try await asset.load(.mediaSelectionGroup(forMediaCharacteristic: .audible))

if let adGroup {
    let adOptions = AVMediaSelectionGroup.mediaSelectionOptions(
        from: adGroup.options,
        with: .describesVideoForAccessibility
    )

    if let adOption = adOptions.first {
        playerItem.select(adOption, in: adGroup)
    }
}

System Accessibility Settings

AVPlayer automatically selects captioned/described tracks when the user enables these in Settings → Accessibility → Subtitles & Captioning. You don't need manual selection unless providing a custom media selection UI.

Check user preferences:

import MediaAccessibility

let captioningEnabled = MACaptionAppearanceIsDisplayedAutomatically(.user)

SwiftUI VideoPlayer

SwiftUI's VideoPlayer inherits AVPlayer's automatic accessibility track selection:

import AVKit
import SwiftUI

struct AccessibleVideoView: View {
    let player: AVPlayer

    var body: some View {
        VideoPlayer(player: player)
            .accessibilityLabel("Training video")
            .accessibilityHint("Double-tap to play or pause")
    }
}

Custom Player Controls

When building custom video controls, ensure:

  • Play/pause, seek, and volume controls are all focusable and labeled
  • Current time and duration are announced on focus changes
  • Captions toggle is available and labeled
  • Progress slider uses accessibilityValue to announce time position
  • Controls remain visible/accessible when captions overlay is active
Button(action: toggleCaptions) {
    Image(systemName: captionsEnabled ? "captions.bubble.fill" : "captions.bubble")
}
.accessibilityLabel(captionsEnabled ? "Captions on" : "Captions off")
.accessibilityHint("Toggles closed captions")

Source: SKILL.md on GitHub

No alerts17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    The skill provides comprehensive guidance and code patterns for implementing accessibility features in iOS and macOS applications using SwiftUI, UIKit, and AppKit. It covers VoiceOver, Voice Control, Switch Control, and Dynamic Type, along with App Store declaration requirements. No security vulnerabilities or malicious patterns were detected.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer6mo

    1/2 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 45c9085. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 days ago.

Steadyupdated 3 months ago
  • voiceover
  • swiftui
  • uikit
  • accessibility
  • ios
  • macos
  • keyboard-access
  • dynamic-type
  • focus-management
  • assistive-technologies

README badge

README badge for dpearson2699/swift-ios-skills/ios-accessibility

Implements VoiceOver, Voice Control, Switch Control, and Full Keyboard Access support in iOS/macOS apps with SwiftUI and UIKit. Covers accessibility labels, focus management, Dynamic Type, custom rotors, and system preference handling (Reduce Motion, Increase Contrast, Bold Text). Includes patterns for testing accessibility compliance and auditing assistive technology support.

Generated from the current SKILL.md.

Does this skill cover both SwiftUI and UIKit?
Yes. The skill provides patterns for SwiftUI accessibility modifiers, focus management with @AccessibilityFocusState, and Dynamic Type support, plus separate UIKit patterns for trait modification, modal dialogs, and accessibility notifications.
What assistive technologies does this cover?
VoiceOver, Voice Control, Switch Control, Full Keyboard Access, and Assistive Access (iOS 18+). The skill also covers focus management, custom rotors, and system accessibility preferences like Reduce Motion and Increase Contrast.
Does this include testing and auditing guidance?
Yes. The skill references automated accessibility testing with XCTest and includes a review checklist for auditing a11y compliance, plus common mistakes to avoid.
Can I use this skill if I'm working with custom controls?
Yes. The skill covers custom control patterns including trait assignment, custom actions for Switch Control, custom rotors, and focus management with @AccessibilityFocusState for sheet and modal dismissals.
Does this support Dynamic Type and system preferences?
Yes. The skill includes @ScaledMetric patterns for Dynamic Type, and covers respecting system accessibility preferences: Reduce Motion, Reduce Transparency, Bold Text, and Increased Contrast.

Generated from the current SKILL.md. These answers refresh after source changes.