When I drag from a button on the storyboard to my view controller Swift file, I only get the option to insert an Outlet or Outlet Collection.
Similarly, if I create the IBAction manually and try to connect it to a button on the storyboard, I can't connect the two.
This problem is only appears in one of my projects, but it happens on all the storyboards in my project.
Seems like an Xcode bug, but maybe someone knows of a workaround.
(It's hard to tell, but the element being dragged in the screenshot is a button.)
I have very similar issue in my Swift project that was driving me mad.
It turned that's it is the problem of mixing custom protocol adoption in extension of UIButton
having @IBInspectable
property. More details below.
I finally found out that's because I have following code in my project: (copyright goes to Kevin McNeigh: https://www.iphonelife.com/blog/31369/swift-programming-101-mastering-dynamic-type-ios)
protocol DynamicTypeChangeHandler {
var typeObserver: Bool {get set}
}
extension UIButton: DynamicTypeChangeHandler {
@IBInspectable var typeObserver: Bool {
// ...
}
}
If I remove either protocol adoption from the extension or @IBInspectable keyword, I can again setup actions in Interface Builder. Sheer lunacy. Xcode <3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With