VoiceOver with UISegmentedControl in Swift
I am trying to add VoiceOver to a Segmented Control but the Apple example code does not work with Swift 3:
The Objective C code:
NSString *title = @”∫”;
title.accessibilityLabel = @”Integral”;
does not work with Swift like this:
var title: NSString = "∫"
title.accessibilityLabel = "Integral"
segmentedControl.insertSegment(withTitle: title, at: 0, animated: false)
Swift will only accept a String but I need to add an NSString since it has the VoiceOver attributes.
Can any help with this?
Is there a better approach for adding accessibility or VoiceOver to a segmented control?