0

How to get number of methods and variables in a class Swift iOS like reflection in Java. Something like getDeclaredMethods() and getDeclaredFields().

getDeclaredMethods()       //will return array of methods defined.
getDeclaredFields()        //will return array of variables defined.
Milo
  • 3,365
  • 9
  • 30
  • 44
vaibby
  • 1,255
  • 1
  • 9
  • 23

1 Answers1

0

You use the Mirror(reflecting: Any)and then loop through the mirror.children

This however wont tell you any information about the functions inside it. the child only contains the variable names and values.

i guess This will be a sufficient answer tho.

Vollan
  • 1,887
  • 11
  • 26