How to create custom code completion macros in Xcode. I googled but I don't find anything
for example, when i was '[' xcode add text '[""]'
it can possible ?
Update: In Xcode 11 and later, the library is accessed via the + button in the project window's tool bar. Hold the option key as you click the button to make the Library window persistent so that you can drag your snippet into it. There's also an Editor->Create Code Snippet menu item that creates a new snippet from any selected text.
Original answer:
It's easy to add your own completions, but this might be one of Xcode's most under appreciated features. Select some text and then drag and drop the selected text in the snippets library in the lower right corner (icon looks like {}):

You can then double-click the new snippet to edit the name, completion shortcut, scope, language, etc., as well as the text of the snippet itself. If you want to add tokens for the user to fill in similar to what the built-in snippets do for parameters, denote them as <#yourtoken#> in the snippet text. There's more information in the docs at Creating a Custom Code Snippet.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With