Spine icon indicating copy to clipboard operation
Spine copied to clipboard

Array of custom type in resource definition

Open yahyaalshaar opened this issue 7 years ago • 0 comments

It seems that I can't tell spine for custom object type in attribute definition since it will crash at run time so I make definition "any"

In my case I have an array of "WorkingHourAttribute" if I keep this type definition the app will crash: '*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Example.BranchResource 0x600000195880> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key workingHours.''

`class BranchResource: Resource {

var workingHours: [Any]? // I want => workingHours: [WorkingHourAttribute]?
override class var fields: [Field] {
    return fieldsFromDictionary([
        "workingHours": WorkingHourAttribute().serializeAs("working-hours")
        ])
}`

how to write array definition in resource class with custom object attribute Thanks in advance

yahyaalshaar avatar Jun 01 '17 11:06 yahyaalshaar