Reputation: 164
How can I make Xcode autocomplete a @property
directive?
I saw it on someone's Mac.
Upvotes: 4
Views: 1746
Reputation: 539765
As Alladinian already mentioned in a comment, you can achieve this with a custom "Code Snippet" in Xcode. To define a code snippet, you first type the text in a source file, for example
@property (nonatomic, strong) <#type#> *<#name#>;
(<#...#>
is a special placeholder, so that you can jump to "type" and "name" using the
tabulator key later.)
Then you select the entire line, and drag it to the "Code Snippet Library":
Double-click on the new code snippet, and give it a name and a shortcut:
Now, when you type the shortcut, Xcode will offer the completion:
Select your code snippet, and it will be inserted in the source file:
You can use the tabulator to jump to "type" and "name".
Upvotes: 10
Reputation: 46543
Check the box shown in RedBox, your XCode autocompletion will work
EDIT:
If you are able to see in .m file, then surely your .h contains some syntax error. Due to that error LLVM compiler shows signal to correct and your autocompletion is not working.
EDIT 2:
As per your comment, while typing @prop
the autocompletion does not show erty(,)
even in XCode4.6
Upvotes: 2
Reputation: 7673
The @property does not auto-complete itself. However, the @synthesize does. See this question:
Xcode [ESC] fail to auto complete the property in .m file
Upvotes: 0