I encounter strange compile error when accessing UITextView as object conforming to UITextInputTraits:
protocol MyEditingView:UITextInputTraits where Self: UIView {
}
extension UITextView:MyEditingView {
}
class SomeClass {
var editingView:MyEditingView = UITextView()
func someFunc() {
editingView.autocorrectionType = .no
}
}
"Cannot assign to property: 'self' is immutable"
But if property is explicitly declared in protocol, without inheriting from UITextInputTraits it is compiled successfully.
protocol MyEditingView where Self: UIView {
var autocorrectionType: UITextAutocorrectionType { get set }
}
And property declaration is same as in UITextInputTraits.
Swift 4.2, XCode 10.1