Impossible to link outlet to custom protocol property in Xcode (Interface Builder)

Originator:yonic.surny
Number:rdar://32813076 Date Originated:6/16/2017
Status:Open Resolved:
Product:iOS+SDK UIKit Product Version:iOS 10.3
Classification:Suggestion Reproducible:Always
 
Summary:
See steps to reproduce.

Steps to Reproduce:
In Xcode:
* Create a custom protocol:

@objc protocol FooBarDelegate {
    func foo(_ bar: Any)
}

* In a view (or view controller) add an outlet to the delegate:

@IBOutlet private weak var delegate: FooBarDelegate!

* Open the storyboard (or xib) and try to link the delegate property to any object.

Expected Results:
Ability to link the property to an object (same as any standard protocol like UIScrollViewDelegate, UITableViewDataSource, ...).

Observed Results:
No object is highlighted, impossible to link the property to an object.

Version:
Xcode 8.3 (iOS 10)
Xcode 9 (iOS 11)

Notes:
Following this method works: https://stackoverflow.com/a/29903609/1197572

* Declare the delegate as an AnyObject - @IBOutlet var delegate: AnyObject!
* Connect the delegate in Interface Builder
* Change the outlet's type to your protocol, e.g. @IBOutlet var delegate: MyDelegate

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!