-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Description
| Previous ID | SR-2426 |
| Radar | rdar://problem/27853737 |
| Original Reporter | @mattneub |
| Type | Bug |
| Status | Resolved |
| Resolution | Done |
Environment
Xcode Version 8.0 beta 6 (8S201h)
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug |
| Assignee | None |
| Priority | Medium |
md5: 58ac2bdb30ba59138e7ec74200e17519
Issue Description:
This doesn't compile:
@IBAction func doButton (_ sender:Any!) { // ...The compiler complains: Argument to @IBAction method cannot have non-object type 'Any!'. This complaint is spurious; all objects arriving from Objective-C are now arriving as Any, and there is no reason why IBAction methods should not do the same.
The proof is that if, having created my outlet in IB, I now delete the word @IBAction, I can change AnyObject to Any and the method compiles and works perfectly.
Thus I argue that this compile error is a dinosaur and should be expunged. With all Objective-C objects arriving as Any, my code looks silly with this smattering of AnyObject usages sticking out like a sore thumb. I should be able to change them to Any.
(I have also filed a radar asking that Interface Builder should offer Any as an alternative when it forms the action handler signature automatically.)