Mastering macOS Programming
上QQ阅读APP看书,第一时间看更新

Speeding it up with code snippets

One of the best and simplest aids to working quickly in Xcode is the code snippets feature. To see the list of both Xcode's default snippets and user code snippets, type command + option + control + 2 to bring them up in the Utilities pane:

The preceding screenshot shows just a few of the dozens of snippets that come supplied with Xcode. Despite this generous supply, it's probably fair to say that most of them are hardly worth remembering, given that Xcode's code completion has come such a long way. Whether we really need a snippet that is no more than the following example is debatable:

deinit { 
<#statements#>
}

This is particularly true when one considers that the default set of snippets is not editable, and thus cannot be assigned keyboard shortcuts.