I am trying to get method list of a class. Here's my code
class MyClass: NSObject {
func method1(){
print("Method1")
}
func method2(){
print("Method2")
}
}
var methodCount: UInt32 = 0
let methodList = class_copyMethodList(MyClass.self, &methodCount)
for i in 0..<Int(methodCount){
let unwrapped = methodList?[i]
print(NSStringFromSelector(method_getName(unwrapped!)))
}
Output is :
init
method1
and method2
are not displaying in output.
Please correct me if i am doing something wrong. Help will be appriciated.
Thank You