Can't connect delegate property of CustomView
declared as @IBOutlet toViewController
in Interface Builder – simply can't establish a connection.
Here's the code
class CustomView: UIView {
@IBOutlet var delegate: CustomViewDelegate?
}
@objc protocol CustomViewDelegate {
...
}
class ViewController: UIViewController, CustomViewDelegate {
...
}
@objc
is used because of swift protocol, IBOutlet property cannot have non-object type, don't know why protocol CustomViewDelegate: class {}
doesn't work.
Anyone else came across something like that?