Task

Invoke an object method where the name of the method to be invoked can be generated at run time.



Related tasks

 Respond to an unknown method call.
 Runtime evaluation


import Foundation
 
class MyUglyClass: NSObject {
  @objc
  func myUglyFunction() {
    print("called myUglyFunction")
  }
}
 
let someObject: NSObject = MyUglyClass()
 
someObject.perform(NSSelectorFromString("myUglyFunction"))