[swift-evolution] [Review] SE-0160: Limiting @objc inference

Jordan Rose jordan_rose at apple.com
Wed Mar 22 19:51:16 CDT 2017

[Proposal: https://github.com/apple/swift-evolution/blob/master/proposals/0160-objc-inference.md]

I'm definitely in favor of this. Apart from the various motivations discussed in the proposal, this also allows some changes that could improve incremental builds: the generated header ("MyApp-Swift.h") wouldn't need to be regenerated nearly as often with fewer methods exposed to Objective-C. (There's some nuance here that I don't need to go into right now, and there are alternate solutions to that problem, but it's nice that the common case will just put fewer declarations into the header and therefore it would change less often.)

The migration aspect is a little scary. #selector's Objective-C equivalent is @selector, which is easy to search for, but #keyPath maps to plain old strings. For those with Mac apps, properties might even be referenced in Interface Builder using Cocoa Bindings. But limiting the change to Swift 4 mode seems acceptable to me—at least it's a known change that people will be able to point to when things stop working.


More information about the swift-evolution mailing list