In our project, we have fields named "description", "start-time", and "end-time".
Because I cannot use hyphens in variable names in Swift, and because Resource contains a description field already, I constructed my model as follows:
class EventModel: Resource {
var title: String?
var date: Date?
var startTime: String?
var endTime: String?
var descriptionText: String?
var resource: ResourceModel?
var reservation: ReservationModel?
override class var resourceType: ResourceType {
return "events"
}
override class var fields: [Field] {
return fieldsFromDictionary([
"title": Attribute(),
"date": DateAttribute(),
"start-time": Attribute(),
"end-time": Attribute(),
"description": Attribute(),
"resource": ToOneRelationship(ResourceModel.self),
"reservation": ToManyRelationship(ReservationModel.self)
])
}
...
This setup causes me to have this error when dealing with start-time, end-time, and/or description:
2016-10-11 11:27:52.912 Office App[9723:451763] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Office_App.EventModel 0x6080003efe00> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key start-time.'
Is there some configuration I'm using incorrectly or some way I can bypass this issue without having to rename fields in our API?
In our project, we have fields named "description", "start-time", and "end-time".
Because I cannot use hyphens in variable names in Swift, and because Resource contains a description field already, I constructed my model as follows:
This setup causes me to have this error when dealing with start-time, end-time, and/or description:
Is there some configuration I'm using incorrectly or some way I can bypass this issue without having to rename fields in our API?