How do I fix this compilation error?
dynamic var users = [User]()
Property cannot be marked dynamic because its type cannot be represented in Objective-C
I need dynamic so that certain view controllers can observe (via KVO) users and update their views when users changes.
Just as the error mentions
error, not @objc : NSObject:
class A{
}
func something(){
dynamic var a = [A]()
}
should be changed to:
@objc class A:NSObject{
}
func something(){
dynamic var a = [A]() //works, all good
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With