you can find each element UIControlusing an array subviews.
For example, if you want to change accessibilityLabelyours UIAlertController, you can do this:
let contentTitleForAlert = myAlertController.view.subviews[0].subviews[0].subviews[0].subviews[0].subviews[0].subviews[0]
contentTitleForAlert.accessibilityLabel = "¡My text for accessibility label"
Using this method, you can change other elements in UIAlertController. For example:
let contentLabelForAlert = myalertController.view.subviews[0].subviews[0].subviews[0].subviews[0].subviews[0].subviews[1]
contentLabelForAlert.accessibilityLabel = "Text for accessibilityLabel for main content in UIAlertController."
source
share