I need to store some variables like ione and itwo which for method repeat. The variables value will increase,after increased,I want to store the increased variables into userdefaults.
import UIKit
class ViewController: UIViewController
{
override func viewDidLoad()
{
super.viewDidLoad()
/* How can I load UserDefaults here to restore ione's value and
itwo's value and How to store them in UserDefaults ? */
let ionevalue = ione
println(ionevalue)
let itwovalue = itwo
println(itwovalue)
// Do any additional setup after loading the view, typically from a nib.
}
var ione = 0
var itwo = 0
ione++
itwo++
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}