I store array element in NSUserdefault
and retrive from this but I want to remove array element from NSUserdefault
.
retriving from NSuserdefault
let defaults = UserDefaults.standard
let array = defaults.object(forKey: "ArrayString") as? [String] ?? [String]()
print("NSUserDefault :\(array)")
Result:
NSUserDefault :["first", "second","third","fourth","fifth"]
I display this array in CollectionView
now I want to remove from this array how?
Thank You in Advance..
NSUserDefaults.standardUserDefaults().removeObjectForKey("MyKey")
UserDefaults.standard.removeObject(forKey: "MyKey")