To do this safely, you just need to try the optional broadcast. If you think that NSArray has only elements of type CustomClass , you can do this:
var newArray = [CustomClass]() if let customArray = oldClass.arrayOfCustomClass as? [CustomClass] { newArray += customArray }
If you want to extract CustomClass elements (slightly different from what you requested, I know), this is the way:
var newArray = [CustomClass]() for element: AnyObject in oldClass.arrayOfCustomClass { if let custom = element as? CustomClass { newArray.append(custom) } }
source share