Class is not key value coding-compliant

Hi,

 

First of all I am new to coding, so please excuse if this is a simple question/fx.

 

I have created a new class:

 

class Message: NSObject {

    var subject: String = "blah blah blah"
}

I then want to display this from another class,  I want to be user I have KVC working for later on,  so I did this

 

    
myMessage = Message()
print(myMessage.value(forKey: "subject") as Any)

 

What have I missed?

 

[ valueForUndefinedKey:]: this class is not key value coding-compliant for the key subject.

Powered by WPeMatico

About

You may also like...

Comments are closed.