This is my code for setting the defaults.
override func viewDidLoad() {
super.viewDidLoad()
let defaults = UserDefaults.standard
defaults.set("\(coins) $", forKey: "labelName") }
coins is my integer variable. It increases every time someone clicks a button.
labelName is my label that shows how many coins are earned.
How to make it so the number of coins are saved locally and then updated when someone restarts the app?