If you need multiple links embedded in some text (like the classic T&Cs and Privacy policy), the easiest is to use a UITextView & Attributed Strings, and it will work beautifully with VoiceOver. You'll be even able to navigate through links.

App shows a registration form with username and password textfields and a text that says “I agree with the Privacy Policy and the Terms and Conditions” Both Privacy Policy and Terms and Conditions are links. There is some code that shows you how you can use a text field with attributed strings and the link attribute. Implementing the UITextViewDelegate has a function to capture link interactions so they can be handled.

In the example, VoiceOver would say: “I agree with the Privacy Policy and the Terms and Conditions, link”. Swipe down, should announce: “Privacy Policy, link” and you can double tap to open it. Swiping down one more time announces: “Terms and Conditions, link”.

Example code in the image:

let textView = UITextView()
let string = "I agree with the Privacy Policy and the Terms and Conditions"
let attributedString = NSMutableAttributedString(string: string)

attributedString.addAttribute(.link,
                              value: "https://www.yourdomain.com/pp",
                              range: NSRange(location: 17, length: 14))
attributedString.addAttribute(.link,
                              value: "https://www.yourdomain.com/tac",
                              range: NSRange(location: 40, length: 20))
textView.attributedText = attributedString

extension ViewController: UITextViewDelegate {
    func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
        UIApplication.shared.open(URL)
        return true
    }
}

You may also find interesting...

When using VoiceOver on a device without a home button it can first be confusing how you can do a few things, including going to Home from an app, or opening the App Switcher, Control Center, or Notifications. Here's a quick guide for you.

When configuring a largeContentImage or adjustsImageSizeForAccessibilityContentSizeCategory, it is important to use a pdf asset and preserve the vector data so the icons are crisp at any size.

If, for some reason, you are creating a button from scratch, instead of relying on UIButton (perhaps you are adding a fancy micro interaction animation?), take into account that you’ll need to configure the button accessibility trait.

Created in Swift with Ignite.

Supporting Swift for Swifts