Swift @IBOutlets on protocols won't connect in IB

Swift: I have an example custom view with a delegate protocol defined as follows:


@objc protocol CustomViewDelegate: class
{
    func customViewDidDraw(customView: CustomView)
}



The custom view itself has an @IBOutlet for its delegate:


    @IBOutlet weak var delegate: CustomViewDelegate?


This outlet is not connectable at all in the Interface Builder UI in any version of Xcode I've tried. The outlet inspector shows the delegate outlet on my custom view in IB, but as I drag the connection over my UI, nothing highlights as a potential connection target, including the UIViewController that conforms to CustomViewDelegate. Similarly, I'm unable to connect a "New Referencing Outlet" from the UIViewController to the delegate outlet on the custom view.

This does still work in Objective-C. Any tips for getting this to work in Swift?

Thanks.

Swift @IBOutlets on protocols won't connect in IB
 
 
Q