title: Crashing at checkInoutAndNativeTypeCheckedBounds
body: <p>My code looks like this -</p>
  
  <pre><code>func addAfterDeletingPrexisting(type: InsightType, value: [String: Any]) {
      arrayUpdationQueue.sync {
         let insightsLocal = insights
         var outputInsights = insights
         for (offset: index, element: (key: key, value: _)) in insightsLocal.enumerated() {
             if key == type {
                 outputInsights.remove(at: index) // Crashes here
             }
         }
         insights = outputInsights
         self.insights.append((key: type, value: value))
     }
  }
  </code></pre>
  
  <p>And my code is crashing randomly saying</p>
  
  <blockquote>
    <p>Swift._ArrayBuffer._checkInoutAndNativeTypeCheckedBounds (Swift.Int,
    wasNativeTypeChecked : Swift.Bool) -> ():</p>
  </blockquote>
  
  <p>On console when I print <code>index</code> then I get this weird result-</p>
  
  <pre><code>(lldb) po index
  (Function)
  </code></pre>
  
  <p>What am I doing wrong? I understand that crash is due to index not being Int. I have a doubt, is crash due to different queue editing array, but for that only I was using <code>queue.sync</code>.</p>