leavez
leavez

Reputation: 2218

How to convert a function to a string of its name in Swift

func displaySomething(something:UIView) {} -> "displaySomething"

I am crazy about seletor type parameter in Swift. It just pass a string of the function name! I want to implement a function that pass in a function and give out a string, so I can use this function when I want pass a "selector type".

Upvotes: 0

Views: 109

Answers (1)

Jack Lawrence
Jack Lawrence

Reputation: 10772

Swift does not currently include runtime APIs to make this possible.

If you're interested in a feature to do this, you can file a feature request at http://bugreport.apple.com.

Upvotes: 1

Related Questions