Oren Edrich Oren Edrich - 1 month ago 4x
iOS Question

Save UIButton state

class GameViewController: UIViewController, UIPopoverPresentationControllerDelegate {

@IBOutlet weak var instructions: UIButton!

@IBAction func instructions(_ sender: AnyObject) {
instructions.isHidden = true


This is my code to display instructions on how to use the app.
I currently have an image-button and when I click on it the image disappears. This works great but I don't want the instructions to pop up overtime someone opens the app. I want to use "Userdefaults" to save the state of the button.
I just recently updated to swift 3.0 and I can't find anyone who explains how to it, please help!

UserDefaults.standard().set("True", forKey: "isHidden")

print("\(UserDefaults.standard.value(forKey: "isHidden")!)")