As the saying goes, smart programmers learn to “slack off” to improve development efficiency. There are snippets of code that we use a lot in our daily development, and you might think that defining some macros would solve the problem, but what about, say,UITableView protocol methods, or when you’re writing a Demo and you want to quickly define a UIButton(unless, of course, you’re using a storyboard)?

Okay, so what is a snippet?

So we say if in XCode, ifelse, press enter, and there it is

This is the code fragment that the system has defined for us. It can quickly complete the code fragment we want to greatly improve the programming efficiency of programmers. What we need to do is to achieve this effect.

Step is actually very simple, using UITableView protocol method example.

Remember that! <# the parameter name prompt you want to give #> is key.

Finally, Xcode default in the code snippet in ~ / Library/Developer/Xcode/UserData/CodeSnippets, can be directly copied to others to use, resource sharing.

In addition, there are many other common code snippets that can be defined much better than macros. For example, singleton…. Attribute… Try it yourself.

@reprint please indicate,iOS sector @confused little bookboy, thank you!