When setting the userInteraction
property, also add/remove .notEnabled
accessibility trait for that view
func disable() {
view.isUserInteractionEnabled = false
view.accessibilityTraits.insert(.notEnabled)
}
func enable() {
view.isUserInteractionEnabled = true
view.accessibilityTraits.remove(.notEnabled)
}