swift - Get [String] from NSUserDefaults.standardUserDefaults().dictionaryRepresentation().keys -
nsuserdefaults.standarduserdefaults().dictionaryrepresentation().keys
returns [nsobject]
need (and expect) [string]
. coffee i'm missing?
that returns lazybidirectionalcollection<mapcollectionview<dictionary<key, value>, key>>
. can add .array
array instance back, use map
cast values string
:
let keys = nsuserdefaults.standarduserdefaults().dictionaryrepresentation().keys.array.map { $0 string } println(keys) // [nslanguages, nsinterfacestyle, applelanguages]
Comments
Post a Comment