Last active
November 5, 2020 10:38
-
-
Save sanllier/c2d672f81e7dffbdec39d2d9774be475 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let objcSelector = Selector("veryUsefulMethod") | |
| typealias CFunction = @convention(c) (AnyObject, Selector) -> Void | |
| let impl = class_getMethodImplementation(type(of: self).self, objcSelector) | |
| let callableImpl = unsafeBitCast(impl, to: CFunction.self) | |
| callableImpl(self, objcSelector) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment