Xcode 9.0 (App Store version)
Swift 4 (not in Swift 3 compatibility mode)
In order to mutate class-type existentials, protocols used in the existential must have a class requirement. This seems like a bug. Consider the following Swift code with class A, subclass B, and protocol P:
In Swift 4, this generates the error:
test.swift:16:7: error: cannot assign to property: 'c' is a 'let' constant
c.foo = ""
test.swift:14:1: note: change 'let' to 'var' to make it mutable
let c: AandP = B()
Since AandP must be a class type, this seems odd. Including AnyObject in the existential doesn't help. The only fix appears to be make declaring P as protocol P: class. This is unfortunate, since in the real project I want to use UIView & UITextInput to represent any text input view. I can't configure the view using configuration available via UITextInput due to this constraint, and I can't update the UITextInput protocol to have a class requirement because the protocol lives in UIKit.