saoudrizwan / Disk

Delightful framework for iOS to easily persist structs, images, and data
MIT License
3.08k stars 170 forks source link

Add array of strings #74

Closed Skylerbob closed 2 years ago

Skylerbob commented 5 years ago

Is there a way that I could add an array of strings for one key, and leave the other 2 as non-array strings? Thanks

Currently I have this (Interests is an array of strings): let message = Message(interests: interests, title: inputedTitle, body: inputedBody) //Cannot convert value of type 'Array<Any>' to expected argument type 'String'

saoudrizwan commented 2 years ago

No because Disk requires you specify a type so it knows how to properly store it. In your case I recommend creating a struct if you have a complicated data model, but it looks like you want to mix and match array and string types for the sake of convenience, is that correct? I don't recommend doing that because it could get confusing for you not knowing what exactly you're saving/retrieving.