Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

Swift 4: Argument #selector is not exposed to Objective-C #59

Open
untalfranfernandez opened this issue Sep 13, 2017 · 0 comments
Open
Assignees

Comments

@untalfranfernandez
Copy link

If you try to use BothamUI with Swift 4, you'll get that error in BothamPullToRefreshHandler.swift file.

The following text explains what's going on:

The whole reason for this warning in the first place is the result of SE-0160. Prior to Swift 4, internal or higher Objective-C compatible members of NSObject inheriting classes were inferred to be @objc and therefore exposed to Objective-C, therefore allowing them to be called using selectors (as the Obj-C runtime is required in order to lookup the method implementation for a given selector).
However in Swift 4, this is no longer the case. Only very specific declarations are now inferred to be @objc, for example overrides of @objc methods, implementations of @objc protocol requirements and declarations with attributes that imply @objc, such as @IBOutlet.
The motivation behind this, as detailed in the above linked proposal, is firstly to prevent method overloads in NSObject inheriting classes from colliding with each other due to having identical selectors. Secondly, it helps reduce the binary size by not having to generate thunks for members that don't need to be exposed to Obj-C, and thirdly improves the speed of dynamic linking.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant