Skip to content
This repository has been archived by the owner on Nov 13, 2020. It is now read-only.

Arrays? #21

Closed
steelzeh opened this issue Jun 6, 2016 · 3 comments
Closed

Arrays? #21

steelzeh opened this issue Jun 6, 2016 · 3 comments
Labels

Comments

@steelzeh
Copy link

steelzeh commented Jun 6, 2016

Add support for arrays?

class Person: NSObject, Storable {
    var person:[Children]
}

class Children: NSObject, Storable {

    var name:String!
    var age:NSNumber!
}

I'm getting this
[testapp.Children encodeWithCoder:]: unrecognized selector sent to instance

@Oyvindkg
Copy link
Owner

Hello steelzeh,

Only objects conforming to NSCoding can be stored in collections. NSCoding is used to encode and decode objects.

NSHipster have written a Swift tutorial for the NSCoding protocol. I recommend you to check it out.

Thanks for pointing it out. I will update the documentation.

@steelzeh
Copy link
Author

Ohh shit didn't know that. I'll try adding NSCoding.
But will it just store the objects as NSData?

@Oyvindkg
Copy link
Owner

Yes, all collections will be converted to NSData. The plan is to store Storable objects in their respective tables, but this isn't implemented yet.

I have just delivered my final exam for the semester, so I will have some time to kill in the coming weeks. I hope to work on SwiftyDB as much as possible.

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

No branches or pull requests

2 participants