Skip to content

Instantly share code, notes, and snippets.

@milancermak
Created December 21, 2015 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milancermak/6c5d22cbbff4d6025895 to your computer and use it in GitHub Desktop.
Save milancermak/6c5d22cbbff4d6025895 to your computer and use it in GitHub Desktop.
A way how to introspect methods in Swift at runtime
var methodCount: UInt32 = 0
let methods = class_copyMethodList(anInstance.dynamicType, &methodCount) // replace anInstace
for i in 0..<Int(methodCount) {
NSLog("method: \(NSStringFromSelector(method_getName(methods[i])))")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment