I am trying to overcome the limitation explained here about not being able to directly connect IB elements to outlets with protocol types.
The workaround mentioned is not ideal because what I need an Outlet Collection and connecting a new element means redoing this again and again and that defeats the purpose of this part of my project.
So I figured I would create an intermediate Controller whose sole purpose was to readily translate a an AnyObject outlet collection to the array typed with my Protocol.
I come to discover that the array casting you see below throws the error: "Type 'FormField' does not conform to protocol 'AnyObject'"
However, the simple per-item loop commented out actually works.
I would like to understand why the former fails and if there is a way to actually avoid the per-item loop.
class FormViewController: UIViewController, Form {
    @IBOutlet var fieldCollection: [AnyObject]!
    var formFields: [FormField]!
    override func viewDidLoad() {
        super.viewDidLoad()
        self.formFields = self.fieldCollection as! [FormField]!
        /*
            self.formFields = [FormField]()
            for field in self.fieldCollection {
            self.formFields.append(field as! FormField)
        }*/
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
}
 
     
    