title: Update and delete object inside userDefaults by INDEX
body: <p>I am created 3 object and save each of this inside user defaults how I am can update not all data, are only object Number 3?</p>
  <p>This is code how I am save and fetch data:</p>
  <pre><code>  func savePlayer(player: [Player]) {
          UserDefaults.standard.set(try? PropertyListEncoder().encode(player), forKey:&quot;player&quot;)
          UserDefaults.standard.synchronize()
      }
      
      func getSports() -&gt; [Player]? {
          if let data = UserDefaults.standard.value(forKey:&quot;player&quot;) as? Data {
              let decodedSports = try? PropertyListDecoder().decode([Player].self, from: data)
              return decodedSports
          }
          return nil
      }
  </code></pre>
  <p>This is my objects:</p>
  <pre><code>let playerOne = Player(id: 1, url: &quot;https:\\www.google - 1.com&quot;, color: &quot;#color 1&quot;, image: &quot;imageBase64One&quot;, flag: false, position: 1)
  
  let playerTwo = Player(id: 2, url: &quot;https:\\www.google - 2.com&quot;, color: &quot;#color 2&quot;, image: &quot;imageBase64Two&quot;, flag: false, position: 2)
  
  let playerThree = Player(id: 3, url: &quot;https:\\www.google - 3.com&quot;, color: &quot;#color 3&quot;, image: &quot;imageBase64Three&quot;, flag: false, position: 3)
  </code></pre>
  <p>Model of data:</p>
  <pre><code>class Player: Codable {
      let ID: Int
      let URL: String
      let Color: String
      let Image: String
      var Flag: Bool
      let Position: Int
      
      init(id: Int, url: String, color: String, image: String, flag: Bool, position: Int) {
          self.ID = id
          self.URL = url
          self.Color = color
          self.Image = image
          self.Flag = flag
          self.Position = position
      }
  }
  </code></pre>
  <p>I can't understand how update for example option &quot;flag&quot; for second object and and also delete only object two not all.</p>