sunshinejr / SwiftyUserDefaults

Modern Swift API for NSUserDefaults
http://radex.io/swift/nsuserdefaults/static
MIT License
4.85k stars 366 forks source link

Dictionary support for version 4. #166

Closed anurag771991 closed 5 years ago

anurag771991 commented 5 years ago

Hi I am getting this issue while defining a key for array and couldn't find how could I store and retrieve array using SwiftyUserDefaults.

'[String : String]' does not conform to protocol 'DefaultsGettable'

anurag771991 commented 5 years ago

why it's not working for type Dictionary?

private let deviceInfoKey = DefaultsKey("deviceName")

anurag771991 commented 5 years ago

@radex , i am stuck can you please help me how can i use this Defaults for dictionary

n1schal commented 5 years ago

@radex any info on how to store [String:String] or [String:Any] on 4.x.x? It worked with 3.0.1 easy...

sunshinejr commented 5 years ago

Hey @anurag771991, @n1schal. Currently dictionary support is not supported, but I'll try to find some time to add it to version 4.0.0-beta.1. (Because I cannot guarantee that I will find time before 4.0.0 release) if anyone wants to help, please take a look at Custom Types in Readme and add a new bridge for Dictionaries in a PR. It will be greatly appreciated!

sunshinejr commented 5 years ago

Started the works in #179.