title: Swift Remove element from an array and then remove the same element from an array inside of a dictionary
body: <p>So I have a struct and a dictionary that look like this:</p>
  
  <pre><code>struct minStruct {
  
  var labelText:String?
  var descText:String?
  var imaginator:UIImage?
  var rea:String?
  
  var url:NSURL?}
  
  var dict = [String:[minStruct]]()
  </code></pre>
  
  <p>Thus, I have a dictionary with the value as an array of structs. In my application I create an array of all the structs inside the dictionary to be able to show the structs in a tableView, which is done by this code:</p>
  
  <pre><code>let dictValues = Array(dict.values)
  let dictFlat = Array(dictValues.flatten())
  </code></pre>
  
  <p>The new array dictFlat is used for populating the tableView, as it contains every struct that was contained inside of the original dictionary. If I would like to remove a struct from the tableView, i would of course remove it from the array dictFlat, however I need to remove the same struct from the original dictionary (dict) to achieve what I want. So my question is simply how to remove the same struct that is deleted from the array dictFlat from the dictionary dict. To clarify, you could you this example:</p>
  
  <pre><code>dict = ["Food":[minStruct(labelText: "this is a string", descText: "Also a string", imaginator: UIImage(named: "image-name")!, rea: "also a string", url: NSURL(string: "https://www.google.com")]]
  </code></pre>
  
  <p>Now dictFlat will contain the struct displayed inside of dict above, and now I want to delete that struct from both. Using swipe to delete from the tableView, the only struct that will be deleted is the one inside of dictFlat (using the indexPath to delete just as you would usually do when deleting from a tableView). Now I want to delete the same item which was deleted from dictFlat and also from the tableView, from the original dictionary (dict). So what I want is to check if dict contains the struct that was deleted from dictFlat, and if it does contain it, it shall be deleted.</p>
  
  <p>I hope that I was clear enough, thanks in advance!</p>