Created
July 6, 2022 10:12
-
-
Save shalom-aviv/ccfef368b835ae21d8baf60c74677726 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
extension NSObject { | |
var getAllSelectors: [Selector] { | |
var methodCount: UInt32 = 0 | |
guard | |
let methodList = class_copyMethodList(type(of: self), &methodCount), | |
methodCount != 0 | |
else { | |
return [] | |
} | |
return (0 ..< Int(methodCount)) | |
.compactMap { method_getName(methodList[$0]) } | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment