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?
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.
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.
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".
I just find a plugin that makes exactly what I wanted, SCXcodeSwitchExpander . It works like a charm :D
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.