Can not connect a control to an existing IBAction which receives Any parameter.
Originator: | craiggrummitt | ||
Number: | rdar://31011057 | Date Originated: | 13/3/2017 |
Status: | Open | Resolved: | |
Product: | Xcode | Product Version: | Version 8.2 (8C38) |
Classification: | Serious Bug | Reproducible: | Always |
Can not connect a control's event to an existing IBAction, if the IBAction is expecting an Any parameter. If you change the parameter type of the IBAction to AnyObject, or a control's type such as UIButton, this problem is resolved. Steps to reproduce 1. New Xcode Project 2. Drag on two buttons to storyboard 3. Open Assistant Editor 4. Connect a button to an IBAction, by control dragging from button in storyboard to ViewController.swift, select 'Action' connection, and leave the 'type' as the default 'Any'. Give the action a name (let's call it 'hitMe' and select 'Connect'. 5. Control-drag the second button to the 'hitMe' IBAction, and...wait - why isn't it letting me? Weird. Right click on the button and drag from the TouchUpInside event to the IBAction. No, that didn't work either. How about from the TouchUpInside event in the Connections Inspector? Nope. Hmm... Expected results You expect that the IBAction method will highlight, and allow you to drag a second control to the same IBAction. Actual results The IBAction method does not highlight. Additional notes Problem can be resolved by changing the parameter type to UIButton, or AnyObject.
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!