There is an issue I have in swift with the object type conformed to @objc
protocol with the property that is defined as @optional var
.
Swift 5.3.2 assumes that optional property is immutable.
import Foundation
@objc protocol Bar {
@objc var mutableVar: Bool { get set }
@objc optional var mutableVar2: Bool { get set }
}
func foo(_ object: AnyObject & Bar) {
var object = object
object.mutableVar = false // compiles fine
object.mutableVar2 = false // error: Can not assign to property: 'object' is immutable
}