I have this for-in loop:
for button in view.subviews { }
Now I want button to be cast into a custom class so I can use its properties.
The answer provided by vacawama was correct in Swift 1.0. And no longer works with Swift 2.0.
If you try, you will get an error similar to:
'[AnyObject]' is not convertible to '[AClass]';
In Swift 2.0 you need to write like:
for button in view.subviews as! [AClass] { }