Accessibility dialog - iOS
On iOS, you can show an alert
by using UIAlertController
. Set the style
to alert
to display a dialog. You should always add a close action in the cancel
style. The focus of assistive technologies is automatically trapped inside the alert while it's visible.
let alert = UIAlertController(
title: "Confirm Appt membership?",
message: "Your bank account will be billed.",
preferredStyle: .alert
)
alert.addAction(UIAlertAction(title: "Proceed", style: .default, handler: { action in
// Proceed
}))
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { action in
// Cancel
}))
present(alert, animated: true)