I am trying figure out what would be the best option to save some info into cache. I want it to be in there until notification pops out and button is pressed. I am already done everything else but I do not know what is the best solution for handling temporary values in cache. I need to use them even if app is closed. Is CoreData
the best solution with NSUserDefaults
? Lets assume that I have an array: var myArray = []
and I have textField. Now I want that texField
input to be in array and if notification category button is pressed it deletes the first array item from the myArray
. I need all this even if app is closed. Faulty code is inside "**".
Edit: The main problem is that how can delete every time the last value from array? It is not working if app is closed but works if it is opened.
This is what i've done so far. This is whre I call out notification and it's action:
This is my array: var myArray = [String]()
Here I add object into array:
And now if notification is fired and button is pressed I would like to fire this function to delete first object from array: