yorke
yorke

Reputation: 3

swift 4 To the variable assignment

I use swift 4 setValuesForKeys() assignment,it will not work,The “content” of this variable,But it will enter

override func setValue(_ value: Any?, forUndefinedKey key: String) {}

enter image description here

I use it on the swift 3.2, it can work, What reason is this excuse me

Upvotes: 0

Views: 204

Answers (2)

Klein Mioke
Klein Mioke

Reputation: 1352

There's an update about @objc and dynamic in Swift 4, if you want to use KVC, add keyword mark it as an OBJC property:

@objc var content = ""

Upvotes: 2

Chan Jing Hong
Chan Jing Hong

Reputation: 2461

I think what you're looking for is this

override func setValuesForKeys(_ keyedValues: [String : Any]) {

}

Upvotes: 0

Related Questions