I think I did not have the code above inside the function. As soon as I placed it inside the function in the declaration of my class, everything went smoothly:
func test() {
let placeHolderValue = 1000
var userDefaults = NSUserDefaults.standardUserDefaults()
userDefaults.setInteger(placeHolderValue, forKey: "placeholder")
}
source
share