title: Swift Cannot assign through subscript: 'peerDeviceSettings' is a get-only property"
body: <p>I have this declaration in my class:</p>
  
  <pre><code>var peerDevice: [String: Any]? 
  
  private var peerDeviceSettings:[String:Any]? {
      get {
          if let settings = peerDevice?["settings"] as? [String:Any] {
              return settings
          }
  
          return nil
      }
  }
  </code></pre>
  
  <p>Now the problem is if I wish to change peerDeviceSettings, such as this:</p>
  
  <pre><code> fileprivate func set(_ value: Any?, forKey key: Key) {
      if peerDeviceSettings != nil {
          peerDeviceSettings?[key.rawValue] = value
      } 
   }
  </code></pre>
  
  <p>I get an error </p>
  
  <pre><code> Cannot assign through subscript: 'peerDeviceSettings' is a get-only property
  </code></pre>
  
  <p>The point is how do I rearchitect this thing without creating a new mutable variable peerDeviceSettings?</p>