title: Saving a Button's Image State Across Different Views
body: <p>My app is a Tableview Controller with cells that contain a fictional character's name. When a cell is selected, a View Controller with specific details about the character is brought up. I want the user to be able to mark off each character that they already own. </p>
  
  <p>I set up the following code to toggle between an empty circle image and a filled circle image to represent whether the user owns the character or not. </p>
  
  <pre><code>let defaults = UserDefaults.standard
  var setImageStatus: String = "off" {
      willSet {
          if newValue == "on" {
              ownedCheck.image = UIImage(named: "filledCircle.jpg")
          } else {
              ownedCheck.image = UIImage(named: "emptyCircle.jpg")
          }
      }
  }
  
  @IBAction func ownedButtonClicked(_ sender: Any) {
      let stat = setImageStatus == "on" ? "off" : "on"
      setImageStatus = stat
      defaults.set(stat, forKey: "imgStatus")
  }   
  
  if let imgStatus = defaults.string(forKey: "imgStatus")
      {
          setImageStatus = imgStatus
      } else {
          setImageStatus = "off"
      } 
  </code></pre>
  
  <p>The problem I am having is that once the ownedButton is clicked, the circle stays filled in for every character. Is there a way to make the button be unique for each character?</p>
  
  <p>I can't post an image yet, so here is a screenshot of the tableview code. 
  <a href="https://i.imgur.com/ofxgoSJ.jpg" rel="nofollow noreferrer">https://i.imgur.com/ofxgoSJ.jpg</a></p>