-
Accessibility design for Mac Catalyst
Make your Mac Catalyst app accessible to all — and bring those improvements back to your iPad app. Discover how a great accessible iPad app automatically becomes a great accessible Mac app when adding support for Mac Catalyst. Learn how to further augment your experience with support for mouse and keyboard actions and accessibility element grouping and navigation. And explore how to use new Accessibility Inspector features to test your app and iterate to create a truly great experience for everyone.
To get the most out of this session, you should be familiar with Mac Catalyst, UIKit, and basic accessibility APIs for iOS. To get started, check out “Introducing iPad apps for Mac” and "Auditing your apps for accessibility."Recursos
Vídeos relacionados
WWDC19
-
Buscar neste vídeo...
-
-
4:11 - Ensuring selection automatically triggers when focus moves to a different cell
myTableView.selectionFollowsFocus = true -
6:01 - Creating a keyboard shortcut
extension AppDelegate { override func buildMenu(with builder: UIMenuBuilder) { super.buildMenu(with: builder) let shareCommand = UIKeyCommand(title: NSLocalizedString("Share", comment: ""), action: #selector(Self.handleShareMenuAction), input: "I", modifierFlags: [.command]) let shareMenu = UIMenu(title: "", identifier: UIMenu.Identifier("com.example.apple-samplecode.RoastedBeans.share"), options: .displayInline, children: [shareCommand]) builder.insertChild(shareMenu, atEndOfMenu: .edit) } @objc func handleShareMenuAction() { } } -
7:20 - Responding to raw key codes
extension MyViewController { override func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) { switch presses.first?.key?.keyCode { case .keyboardLeftGUI: // Handle command key pressed case .keyboardB: // Handle B key pressed default: } } } -
15:45 - Adding accessibility labels to containers, such as UITableView and UICollectionView
tableView.accessibilityLabel = NSLocalizedString("Coffee list", comment: "") -
15:50 - Making great accessibility labels that include state
extension RBListViewController { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let data = tableData[indexPath.row] let label = NSLocalizedString("Coffee list", comment: "") let selectedLabel = NSLocalizedString("%@ selected", comment: "") tableView.accessibilityLabel = label + ", " + String(format: selectedLabel, data.coffee.brand) } } -
16:45 - Adding accessibility containers to improve the navigation experience
let stackView = UIStackView() stackView.axis = .vertical stackView.translatesAutoresizingMaskIntoConstraints = false let locationsAvailable = viewModel.locationsAvailable let titleLabel = UILabel() titleLabel.font = UIFont.preferredFont(forTextStyle: .body).bold() titleLabel.text = NSLocalizedString("Availability: ", comment: "") stackView.addArrangedSubview(titleLabel) for location in locationsAvailable { let label = UILabel() label.font = UIFont.preferredFont(forTextStyle: .body) label.text = "• " + location label.accessibilityLabel = location stackView.addArrangedSubview(label) } stackView.accessibilityLabel = String(format: NSLocalizedString("Available at %@ locations", comment: ""), String(locationsAvailable.count)) stackView.accessibilityContainerType = .semanticGroup
-