How to position cursor cursor in Xcode code fragments

Is it possible to indicate where the cursor should be after inserting a piece of code in xcode 4? Is there a style marker <# #> for this? I am having trouble finding good documentation on code snippets.

+8
xcode code-snippets
source share
2 answers

You can just use <##> . It will show a โ€œbubbleโ€ that you can choose, which is not perfect, but it moves the cursor to that position.

+8
source share

Here are some examples to complement @rdougan's helpful answer. This is not exactly what the OP asked in the question, but it is what I was looking for when I came here based on the name.

User example

 print("<#text#>") 

gives you

enter image description here

Standard example

You can also see any of the standard code snippets to see how they are made. Just click one of them in the code snippet area.

enter image description here

which gives

enter image description here

Reminder on how to add custom code snippets:

Write your code as usual in the code editor. Then select it and drag it into the code snippet window. A dialog box will appear in which you can give it a simple shortcut.

enter image description here

+1
source share

All Articles