Swift 2.2’s#selector syntax introduces a new compiler error:
Argument of '#selector' refers to a method that is not exposed to Objective-C.Fix-it Add '@objc' to expose this method to Objective-C
We cannot simply add
@objcto this method in the originalViewControllerTypeprotocol for a number of reasons. If we do, then the entire protocol needs to be marked@objc, which means[…] Our example here is simple, but imagine a much more complex object graph that makes heavy use of Swift’s value types and a hierarchy of three protocols with this one in the middle. Introducing@objcas the fix-it suggests wouldbreak the entire world in our app.[…]
We can decompose this protocol by separating out all of the
@objccode into its own protocol. Then, we can use protocol composition to reunite them.
Objective-CProgrammingSwift Programming Language
Black Friday
Blog
Archives
Tag Cloud
Top Posts
Recently Updated
RSS Feed ·Comments
Mastodon ·Twitter
Apple News
Trackback
Support this site viaPatreon.
Try my Mac apps: