IOS development for 5 years, 3 years ago, I wanted to summarize my iOS development experience from time to time, but I only wrote 3 articles in 3 years, really ashamed.

Starting today, we’ll pick up where we left off with the iOS work summary, starting with shortcuts to improve coding efficiency.

Let’s cut the crap and get straight to work.

After xcode10, the entry to the custom Code snippets has changed. It’s much more convenient than before.

I describe this content in the form of pictures and texts from three angles. They are the process of custom code block, the use process of custom code block, and the transfer process of custom code block. See the picture in the back.

Enter the picture to speak:

Procedure for customizing code blocks:

Words that need to be replaced can be done as shown below:

Above is an example of defining an attribute, and below is an example of defining a code block:

Select all of the code in our screenshot above, right click to pop up the screenshot below, and go to the Snippet and set it up.

Add and remove custom code blocks

Custom code block usage process

So if we type in the label, we’ll get a hint, for example, if we type ld, it’ll give us a bunch of hints that we can customize, like our delegate definition

The screenshot “Custom code block uses 2” appears. Does that save us a lot of time typing code?

Similarly, we can define other code blocks, like TableView. The few agents we generally have to implement. We can do it as a block of code.

Custom code block migration process

When we change computers, we can also transfer our custom code blocks to other computers.

As we set up the code block, Xcode automatically generates the corresponding file for us. And this file can be copied to our new computer. So we don’t have to worry about changing computers.

The path to the code block is as follows:

~/Library/Developer/Xcode/UserData/CodeSnippets