2
class Alerts { 
  class func test() { 
    print("test") 
  } 
}

Given this class, I'd like to get a list of its class methods, but Mirror only gives me its instance methods:

> Mirror(reflecting: Alerts.self).children.count
0
Bill
  • 44,502
  • 24
  • 122
  • 213
  • Frankly I don't know but did you try `Alerts.class`? – Hermann Klecker Nov 04 '15 at 14:03
  • The docs says `Describes the parts---such as stored properties, collection elements, tuple elements, or the active enumeration case---that make up a particular instance.` So I'm not sure if it is possible. – Dániel Nagy Nov 04 '15 at 14:03
  • you can not get a list of functions in swift. – Edwin Vermeer Nov 04 '15 at 14:28
  • @HermannKlecker Syntax error – Bill Nov 04 '15 at 14:29
  • Sorry, Was worth a try. I thought Alert.class (similar to `[Alert class]` in Obj-C) would return a reference to the class object. In Obj-C class methods are instance methods of the related class object. ... And what if you let it inherit from `NSObject`? – Hermann Klecker Nov 04 '15 at 14:36
  • 1
    There is an answer in this another thread: [https://stackoverflow.com/questions/35744863/reflection-with-swift-get-functions-name-of-a-class](https://stackoverflow.com/questions/35744863/reflection-with-swift-get-functions-name-of-a-class) – Attila Maraz Jul 10 '17 at 12:53

0 Answers0