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