title: enumerateObjectsUsingBlock - casting parameters in Swift
body: <p>I want to refer to enumerated objects with their specific type, instead of just a generic <code>AnyObject!</code>, but cannot find any information about it in the docs.</p>
  
  <p>The signature of <code>enumerateObjectsUsingBlock</code> in Swift is:</p>
  
  <pre><code>func enumerateObjectsUsingBlock(_ block: ((AnyObject!,
                                           Int,
                                           UnsafePointer&lt;ObjCBool&gt;) -&gt; Void)!)
  </code></pre>
  
  <p>and in Objective C:</p>
  
  <pre><code>- (void)enumerateObjectsUsingBlock:(void (^)(id obj,
                                       NSUInteger idx,
                                       BOOL *stop))block
  </code></pre>
  
  <p>If I want to treat the objects that are iterated over as a specific type, in Objective C I simply adjust the signature on the fly, for example:</p>
  
  <pre><code>[array enumerateObjectsUsingBlock:^(NSString *s, NSUInteger idx, BOOL *stop){
      // ...some function of s as NSString, not just id... 
  }];
  </code></pre>
  
  <p>How do I get this behaviour in Swift?</p>