Note that there are some explanatory texts on larger screens.

plurals
  1. POXcode switch/case completion and warnings
    text
    copied!<p>How can I have XCode (4.5, 4G182) complete the case in a switch/case construction, and warn me about missing cases ?</p> <p>For example: </p> <pre><code>for (int i=0;i&lt;[flat elementCount];i++) { NSPoint elements[3]; NSBezierPathElement elem=[flat elementAtIndex:i associatedPoints:elements]; switch (elem ) { case NSMoveToBezierPathElement: break; case NSLineToBezierPathElement: break; case </code></pre> <p>I have seen this in the past. It also warned me about missing cases once the block was closed. How can you achieve this is XCode 4.5 ?</p> <p>Edit: Check Switch Statements IS enabled, and I don't have a warning.</p> <p>Here is a small example in which the completion works:</p> <pre><code>typedef enum { kThisCase = 0, kThatValue = 1, kLastOne = 2 } myEnum; myEnum var= kLastOne; switch (var) { case kThatValue: break; case kLastOne: break; case </code></pre> <p><kbd>CTRL</kbd> + <kbd>SPACE</kbd> here gives me the remaining possible value of myEnum</p> <p><img src="https://i.stack.imgur.com/t3MuW.png" alt="completion is working"> <img src="https://i.stack.imgur.com/4dXl1.png" alt="completion is not working"></p> <p>In the case of NSBezierPathElement completion, when I add this:</p> <pre><code>typedef enum { NSMoveToBezierPathElement, NSLineToBezierPathElement, NSCurveToBezierPathElement, NSClosePathBezierPathElement } NSBezierPathElement; </code></pre> <p>(copied from the quick help panel) before the switch construction, the autocomplete works, but the warnings don't.</p> <h2>Content of NSBezierPath.h</h2> <pre><code>enum { NSMoveToBezierPathElement, NSLineToBezierPathElement, NSCurveToBezierPathElement, NSClosePathBezierPathElement }; typedef NSUInteger NSBezierPathElement; </code></pre> <p>Is it the explanation for the completion not working? Isn't this enum supposed to be the type of NSBezierPathElement ?</p> <p>This doesn't match the quick help panel. In the quick help panel, I have this: <code>typedef enum { NSMoveToBezierPathElement, NSLineToBezierPathElement, NSCurveToBezierPathElement, NSClosePathBezierPathElement} NSBezierPathElement;</code></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload