The following example:
let plus: (Int, Int) -> Int = (+)
print(plus)
debugPrint(plus)
print(UIView.removeFromSuperview)
debugPrint(UIView.removeFromSuperview)
print(UnsafePointer<Int>.distance(to:))
debugPrint(UnsafePointer<Int>.distance(to:))
Prints the useless output:
(Function)
(Function)
(Function)
(Function)
(Function)
(Function)
Is there any way to get function's name in Swift? I mean, not the name of the function which is currently running (#funciton). But the name of a function stored in a variable, or a class function etc. Every language, especially that pretending to be functional, should have such an ability, right?
print(functionName.dynamicType)()required to help compiler to understand it. You can also assign any function like that.