Using Function Naming Placeholders in Swift

This is a nice little trick, which you can find handy while writing a new function. If you don’t want to name your function right away, you can define a placeholder for it and name it later.

func <#name#>() -> Int{


This becomes a placeholder string. And won’t cause any errors while you are still in the middle of writing. Only if you explicitly try to compile it will show error. And if you are using the playground, for placeholders it shows only a warning. So you can run the playground with this still in it.

Let me know if you find it useful.


Namit Gupta

Technical Lead iOS @ONEChampionship | Ex-SDE2 @ Halodoc, Ex-iOS Lead @ Vokal. ❤️ Swift, designing pixel-perfect UI and writing clean code. Check my portfolio here.

Leave a Reply