Closed sebastiaanluca closed 9 years ago
objectForKey
is standard method of NSUserDefaults
class, work without using Prephirences framework
Did you use cocoapod? and import the framework in your file?
import Prephirences
For information subscript
for NSUserDefaults
is defined in NSUserDefaults+Prephirences.swift
The import was the solution! Thought it was a Swift extension of NSUserDefaults, so I could use it without importing anything. Now I can successfully use return self.userDefaults[key]
and return self.userDefaults[key]?[preference]
. Thanks!
PS: maybe add it to the readme? For us noobs ;)
Don't know if I'm doing something wrong here, but just tried the example and it throws an error.
If I use
objectForKey
, it works.Same situation when trying to modify it.
userDefaults["mykey"] = "myvalue"
does not work.