Inclusivity with Voice & Language

May 30 2025 · Swift 5.9, iOS 17, Xcode 15.3

Lesson 02: SwiftUI Accessibility API

Demo: Direct Touch & Announcements

Episode complete

Play next episode

Next

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Direct Touch

When playing this game, users spend most of their time moving the sliders. Although a VoiceOver user can double-tap and hold to activate a slider’s standard action, it would be more convenient if they could move the slider directly.

.accessibilityDirectTouch(options: .silentOnTouch)
.accessibilityValue(String(""))
Activate to dismiss pop-up window, Button.

Announcement

In Xcode, open SuccessView.

var scoreAnnouncement: AttributedString {
  var scoreString = AttributedString("You scored \(score) points on this color.")
  scoreString.accessibilitySpeechAnnouncementPriority = .high
  return scoreString
}
.onAppear {
  AccessibilityNotification.Announcement(scoreAnnouncement)
    .post()
}
.accessibilitySortPriority(2)
See forum comments
Cinema mode Download course materials from Github
Previous: New Features Next: Conclusion