简体   繁体   中英

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".

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM