I have a custom class called Message.
import UIKit
class Message {
var sender: String
var message: String
init?(sender: String, message: String) {
self.sender = sender
self.message = message
}
}
I also have a custom class called Chat that has a variable, called messageList, that is an array of the Message class.
class Chat {
//MARK: Properties
var name: String
var image: UIImage?
var animal: String
var messageList = [Message]()
//MARK: Initialisation
init?(name: String, image: UIImage?, animal: String) {
if name.isEmpty || animal.isEmpty {
return nil
}
self.name = name
self.image = image
self.animal = animal
let firstMessage = Message(sender: "animal", message: "Hi! Nice meeting you!")
self.messageList.append(firstMessage)
}
}
I have tried many different ways, but each time, I get an error when messageList is declared saying the following: "Property cannot be marked @NSManaged because its type cannot be represented in Objective-C" or "Property cannot be declared public because its type uses an internal type".
Thank you in advance,
Alex