When I try to drag and drop an IB outlet from a UIView into my ViewController.swift, XCode crashes (when I press OK after typing a name for the IBOutlet). A popup appears saying: "XCode quit unexpectedly": Ignore, report, reopen. The report says lots of verbose, the most notable warnings are these:
UNCAUGHT EXCEPTION (NSInvalidArgumentException): +[IDESwiftSourceCodeGenerator isTeardownCounterpart:]: unrecognized selector sent to class 0x1159415c0
prepareToAddSourceCodeForCounterparts:documentLocationForCounterpartBlock:addSourceCodeForCounterpartBlock:options:error:] (in IDEKit)
8 0x000000011588a13f -[IDESwiftSourceCodeGenerator prepareToAddPropertyWithName:type:inClassItem:options:error:] (in IDELanguageSupportUI)
I have other IBOutlets working well for UILabels and a Table View, so I do not understand, why this happens.
I am fairly new to Xcode, if you need any additional info to detect what is going wrong, I will gladly provide it. Already tried the usual Clean, Rebuild, Reopen, Restart, and Simulator reset just in case....
Ok, I tried different ways towards desired purpose. I discovered an esoteric workaround:
1-Type this in the .swift file:
@IBOutlet var tableView: UITableView!
2-Do the drag and drop FROM the line of code above TO the UIView in the story board, NOT the other way around, otherwise: XCode will crash.
3-Voila! Bug evaded.
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