ios - Storing Arrays Locally (Swift) -


i want store text typed in text field inside array, , save string locally on device if close app , reopen it, strings contents still accessible. know how can this?

you can use nsuserdefaults store array on device locally.

//to store

var userdefaults = nsuserdefaults.standarduserdefaults() userdefaults.setobject(yourarray, forkey: anykey) userdefaults.synchronize() 

//to read

var myarray : nsarray = userdefaults.objectforkey(anykey) nsarray 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -