title: Cannot assign to immutable expression of type 'Bool?'
body: <p>The compiler throws the error when trying to assign a new value:</p>
  
  <pre><code>Cannot assign to immutable expression of type 'Bool?'
  </code></pre>
  
  <p>I have a class:</p>
  
  <pre><code>class Setting {
     struct Item {
        var text: String
        var selected: Bool?
  
        init(withText text: String) {
           self.text = text
           self.selected = nil  
        }
  
     var items: Any
  
     init(items:Any) {
        self.items = items
     }
  }
  </code></pre>
  
  <p>In source view controller in <code>prepareForSegue</code>:</p>
  
  <pre><code>let item = Setting.Item(withText: user.description)
  let setting = Setting(items: [item])
  destinationViewController.setting = setting
  </code></pre>
  
  <p>In destination view controller:</p>
  
  <pre><code>class DestinationViewController: UITableViewController {
     var setting: Setting!
     override func viewDidLoad() {
        super.viewDidLoad()
  
        //this works
        _ = (setting.items as! [Setting.Item])[index].selected
  
        // this throws the error
        (setting.items as! [Setting.Item])[index].selected = false
     }
  }
  </code></pre>
  
  <p>I declared items as Any because it can either contain [Items] or [[Items]].</p>
  
  <p>How can I make the variable <code>selected</code> mutable?</p>
  
  <p>(I hope this is not a duplicate question, I found many similar questions, but could not solve this.)</p>