I want to automate this piece of code:
let objectType = json["object"]["type"].stringValue;
switch objectType {
case "Message":
activity.item = MessageLib.make(json["object"]) as! MessageItem;
default:
()
}
I want to make an object based on its type. But I don't want to write a new case for each new ObjectType. I just want to make a new object class. OBJECTTYPEItem
Aucun commentaire:
Enregistrer un commentaire