Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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