Reputation: 6971
Recently I've done a small service (available in Github) to return a switch case structure from a given enum
.
The next step is to achieve this behaviour as an Xcode code completion option when I begin typing the enumeration name.
What I want is to add a new option in this popup giving the possibility of generating a switch case with those three options.
I'm searching for documentation to make an Xcode plugin but I can't find much. My first question, and the most important is: is it possible to get the definition of a symbol while I'm typing it, to extract the data of the enum and generate the snippet?
Upvotes: 13
Views: 1051
Reputation: 6971
I just find a plugin that makes exactly what I wanted, SCXcodeSwitchExpander. It works like a charm :D
Upvotes: 0
Reputation: 346
Does the Enumeration section here help? https://developer.apple.com/library/ios/releasenotes/ObjectiveC/ModernizationObjC/AdoptingModernObjective-C/AdoptingModernObjective-C.html#//apple_ref/doc/uid/TP40014150
It states that NS_ENUM "improves code completion".
Upvotes: 0
Reputation: 387
You can have a look at KSImageNamed, an XCode plug-in used to add autocompletion on image name.
You can inspire yourself on its code.
Upvotes: 7
Reputation: 11597
an alternative to what you are suggesting is to save it as a code snippet. it wont be dynamic like you probably want it, but if you are using the same enum over and over, it can work.
Upvotes: 2