View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Videos

Abrir menú Cerrar menú
  • Colecciones
  • Todos los videos
  • Información

Más videos

  • Información
  • Código
  • Build accessible apps with SwiftUI and UIKit

    Discover how advancements in UI frameworks make it easier to build rich, accessible experiences. Find out how technologies like VoiceOver can better interact with your app's interface through accessibility traits and actions. We'll share the latest updates to SwiftUI that help you refine your accessibility experience and show you how to keep accessibility information up-to-date in your UIKit apps.

    Capítulos

    • 0:00 - Welcome
    • 1:30 - Explore the toggle trait
    • 2:46 - Discover multi-platform accessibility announcements
    • 3:58 - Assign priority to announcements
    • 6:36 - Meet the zoom action
    • 8:00 - Refine VoiceOver direct touch experiences
    • 11:08 - Customize accessibility content shapes in SwiftUI
    • 12:48 - Keep accessibility attributes up-to-date in UIKit using block-based setters

    Recursos

    • Accessibility updates
    • Accessibility
      • Video HD
      • Video SD

    Videos relacionados

    WWDC23

    • What’s new in SwiftUI
  • Buscar este video…
    • 1:54 - Add the accessibility toggle trait

      import SwiftUI
      
      struct FilterButton: View {
          @State var filter: Bool = false
      
          var body: some View {
              Button(action: { filter.toggle() }) {
                  Text("Filter")
              }
              .background(filter ? darkGreen : lightGreen)
              .accessibilityAddTraits(.isToggle)
          }
      }
    • 2:31 - Add the accessibility toggle trait with UIKit

      import UIKit
      
      class ViewController: UIViewController {
          override func viewDidLoad() {
              super.viewDidLoad()
      
              let filterButton = UIButton(type: .custom)
      
              setupButtonView()
      
              filterButton.accessibilityTraits = [.toggleButton]
      
              view.addSubview(filterButton)
          }
      }
    • 3:43 - Post an accessibility notification

      import SwiftUI
      
      struct ContentView: View {
          var body: some View {
              NavigationView {
                  PhotoFilterView
                      .toolbar {
                          Button(action: {
                              AccessibilityNotification.Announcement("Loading Photos View")
                                  .post()
                          }) {
                              Text("Photos")
                          }
                      }
              }
          }
      }
    • 5:13 - Assign announcement priority

      import SwiftUI
      
      struct ZoomingImageView: View {
        
          var defaultPriorityAnnouncement = AttributedString("Opening Camera")
      
          var lowPriorityAnnouncement: AttributedString {
              var lowPriorityString = AttributedString("Camera Loading")
              lowPriorityString.accessibilitySpeechAnnouncementPriority = .low
              return lowPriorityString
          }
          
          var highPriorityAnnouncement: AttributedString {
              var highPriorityString = AttributedString("Camera Active")
              highPriorityString.accessibilitySpeechAnnouncementPriority = .high
              return highPriorityString
          }
        
          // ...
      }
    • 5:46 - Post announcements with priority set

      import SwiftUI
      
      struct CameraButton: View {
          
          // ...
        
          var body: some View {
              Button(action: {
                  // Open Camera Code
                  AccessibilityNotification.Announcement(defaultPriorityAnnouncement).post()
                  // Camera Loading Code
                  AccessibilityNotification.Announcement(lowPriorityAnnouncement).post()
                  // Camera Loaded Code
                  AccessibilityNotification.Announcement(highPriorityAnnouncement).post()
              }) {
                  Image("Camera")
                 }
              }
          }
      }
    • 6:15 - Assign announcement priority with UIKit

      class ViewController: UIViewController {
          let defaultAnnouncement = NSAttributedString(string: "Opening Camera", attributes: 
              [NSAttributedString.Key.UIAccessibilitySpeechAttributeAnnouncementPriority: 
              UIAccessibilityPriority.default]
          )
      
          let lowPriorityAnnouncement = NSAttributedString(string: "Camera Loading", attributes:   
              [NSAttributedString.Key.UIAccessibilitySpeechAttributeAnnouncementPriority:
              UIAccessibilityPriority.low]
          )
      
          let highPriorityAnnouncement = NSAttributedString(string: "Camera Active", attributes: 
              [NSAttributedString.Key.UIAccessibilitySpeechAttributeAnnouncementPriority:  
              UIAccessibilityPriority.high]
          )
      
          // ...
      }
    • 6:56 - Add the accessibility zoom action

      struct ZoomingImageView: View {
          @State private var zoomValue = 1.0
          @State var imageName: String?
      
          var body: some View {
              Image(imageName ?? "")
                  .scaleEffect(zoomValue)
                  .accessibilityZoomAction { action in
                      let zoomQuantity = "\(Int(zoomValue)) x zoom"
                      switch action.direction {
                      case .zoomIn:
                          zoomValue += 1.0
                          AccessibilityNotification.Announcement(zoomQuantity).post()
                      case .zoomOut:
                          zoomValue -= 1.0
                          AccessibilityNotification.Announcement(zoomQuantity).post()
                      }
                  }
          }
      }
    • 7:18 - Add the accessibility zoom action with UIKit

      import UIKit
      
      class ViewController: UIViewController {
          let zoomView = ZoomingImageView(frame: .zero)
          let imageView = UIImageView(image: UIImage(named: "tree"))
      
          override func viewDidLoad() {
              super.viewDidLoad()
              zoomView.isAccessibilityElement = true
              zoomView.accessibilityLabel = "Zooming Image View"
              zoomView.accessibilityTraits = [.image, .supportsZoom]
      
              zoomView.addSubview(imageView)
              view.addSubview(zoomView)
          }
      }
    • 7:43 - Respond to accessibility zoom actions with UIKit

      import UIKit 
      
      class ZoomingImageView: UIScrollView {
          override func accessibilityZoomIn(at point: CGPoint) -> Bool {
              zoomScale += 1.0
      
              let zoomQuantity = "\(Int(zoomValue)) x zoom"  
              UIAccessibility.post(notification: .announcement, argument: zoomQuantity)
              return true
          }
      
          override func accessibilityZoomOut(at point: CGPoint) -> Bool {
              zoomScale -= 1.0
      
              let zoomQuantity = "\(Int(zoomValue)) x zoom" 
              UIAccessibility.post(notification: .announcement, argument: zoomQuantity)             
              return true
          }
      }
    • 10:10 - Use accessibility direct touch options

      import SwiftUI
      
      struct KeyboardKeyView: View {
          var soundFile: String
          var body: some View {
              Rectangle()
                  .fill(.white)
                  .frame(width: 35, height: 80)
                  .onTapGesture(count: 1) {
                      playSound(sound: soundFile, type: "mp3")
                  }            
                  .accessibilityDirectTouch(options: .silentOnTouch)
          }
      }
    • 10:46 - Use accessibility direct touch options with UIKit

      import UIKit
      
      class ViewController: UIViewController {
          let waveformButton = UIButton(type: .custom)
      
          override func viewDidLoad() {
              super.viewDidLoad()
              
              waveformButton.accessibilityTraits = .allowsDirectInteraction
              waveformButton.accessibilityDirectTouchOptions = .silentOnTouch
              waveformButton.addTarget(self, action: #selector(playTone), for: .touchUpInside)
              
              view.addSubview(waveformButton)
          }
      }
    • 12:21 - Set the accessibility content shape

      import SwiftUI
      
      struct ImageView: View {
          var body: some View {
              Image("circle-red")
                  .resizable()
                  .frame(width: 200, height: 200)
                  .accessibilityLabel("Red")
                  .contentShape(.accessibility, Circle())
          }
      }
    • 13:35 - Update accessibility values using block-based setters with UIKit

      import UIKit 
      
      class ViewController: UIViewController {
          var isFiltered = false
      
          override func viewDidLoad() {
              super.viewDidLoad()
              // Set up views
              zoomView.accessibilityValueBlock = { [weak self] in
                  guard let self else { return nil }
                  return isFiltered ? "Filtered" : "Not Filtered"
              }
          }
      }

Developer Footer

  • Videos
  • WWDC23
  • Build accessible apps with SwiftUI and UIKit
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines