title: How to remove all gesture recognizers from a UIView in Swift
body: <p>I have written Swift code that attempts to remove all gesture recognizers from all subviews of a given custom UIView type.</p>
  
  <pre><code>let mySubviews = self.subviews.filter() {
     $0.isKindOfClass(CustomSubview)
  }
  for subview in mySubviews {
     for recognizer in subview.gestureRecognizers {
        subview.removeGestureRecognizer(recognizer)
     }
  }
  </code></pre>
  
  <p>But the <code>for recognizer</code> line produces the compiler error:</p>
  
  <pre><code>'[AnyObject]?' does not have a member named 'Generator'
  </code></pre>
  
  <p>I have tried changing the <code>for recognizer</code> loop to <code>for recognizer in enumerate(subview.gestureRecognizers)</code>, but that produces the compiler error:</p>
  
  <pre><code>Type '[AnyObject]?!' Does not conform to protocol 'SequenceType'
  </code></pre>
  
  <p>I see that UIView's <code>gestureRecognizers</code> method returns <code>[AnyObject]??</code>, and I think that the doubly wrapped return values are tripping me up. Can anyone help me?</p>
  
  <p>UPDATE:
  Revised, compiling code is:</p>
  
  <pre><code>if let recognizers = subview.gestureRecognizers {
     for recognizer in recognizers! {
        subview.removeGestureRecognizer(recognizer as UIGestureRecognizer)
     }
  }
  </code></pre>