title: How can I indicate in a Swift that key of for loop is NSString?
body: <p>Here I have a for loop. I know that I store NSStrings in it. How can I indicate the type  of <code>attributeName</code>? I do not want to write everywhere inside the loop, that <code>(relationshipName as NSString)</code>.</p>
  
  <pre><code>for attributeName in managedObject.entity.attributesByName.keys {
  }
  </code></pre>
  
  <h1>UPDATE</h1>
  
  <p>If I add <code>[String]</code> and of the for loop declaration, I get the following error:</p>
  
  <p><img src="https://i.stack.imgur.com/6m4a6.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/bKFGH.png" alt="enter image description here"></p>
  
  <h1>UPDATE</h1>
  
  <p>as String has also problem</p>
  
  <p><img src="https://i.stack.imgur.com/VTLke.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/kKNNJ.png" alt="enter image description here"></p>