Skip to content
This repository has been archived by the owner on Jan 25, 2019. It is now read-only.

Array of custom type in resource definition #185

Open
yahyaalshaar opened this issue Jun 1, 2017 · 0 comments
Open

Array of custom type in resource definition #185

yahyaalshaar opened this issue Jun 1, 2017 · 0 comments

Comments

@yahyaalshaar
Copy link

yahyaalshaar commented Jun 1, 2017

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant