respondToSelector / performSelector with parameter from a string in Swift 3
问题 I have to call method of a class. This method potentially exists or not. I'm looking for a solution from 2 hours. The following works without parameter sayHello() I have the class : class myClass: NSObject { func say(something:String){ print("I say : \(something)") } func sayHello(){ print("Hello") } } 1st step : Create a selector from a string with a parameter let selector = NSSelectorFromString("sayHello" ) let selectorWithParam = NSSelectorFromString("say:" ) 2nd step : Test if the method