Skip to content

Instantly share code, notes, and snippets.

@tarunon
Created June 10, 2014 11:27
Show Gist options
  • Save tarunon/89f0f1904ac7c6e6a0c7 to your computer and use it in GitHub Desktop.
Save tarunon/89f0f1904ac7c6e6a0c7 to your computer and use it in GitHub Desktop.
Print Classes and Methods
func printClasses() {
var count: CUnsignedInt = 0
var clist = objc_copyClassList(&count)
for var i: CUnsignedInt = 0; i < count; i++ {
let c : AnyClass? = clist.memory
println(" #Class \(class_getName(c))")
printMethods(c)
clist = clist.succ()
}
}
func printMethods(c: AnyClass?) {
var count: CUnsignedInt = 0
var mlist = class_copyMethodList(c, &count)
for var i: CUnsignedInt = 0; i < count; i++ {
let m : Method? = mlist.memory
println(" #Method \(method_getName(m!))")
mlist = mlist.succ()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment