Xcode 7.3 -- Cannot fold switch statements

I'm working on a project and use alot of switch statements with a lot of cases and sometimes when editing, I am missing a curly brace somewhere and folding is an easy way to isolate the code and find the problem. Recently, I've noticed that the top-level switch statement will not fold. The cases underneath will fold just fine if there is code contained within two curly braces.


In the code below, the code between the top-level curly braces within the switch statement will not fold. However, the code within each case between the curly braces of the if statements will fold. Is this intended behavior for Xcode or is it a bug?


switch myVariableForSwitch

{

case "1st Case":

if firstCase == true

{

print("Do Something")

}

case "2nd Case":

if secondCase == true

{

print("Do Something Else")

}

default:

print("Do Nothing")

}

What do you mean exactly by "top-level switch statement will not fold" ?


In fact, each case must have a statement ; usually, youy should just put break for a case with no action.

I mean I cannot fold the entire switch statement, only the cases within. Here's what the above code would look like folded if it would let me do it:


switch myVariableForSwitch

{...}


Currently, I can only achieve this (the 1st Case and 2nd Case will fold individually, but I can't fold all the cases within the switch):


switch myVariableForSwitch

{

case "1st Case":

if firstCase == true

{...}

case "2nd Case":

if secondCase == true

{...}

default:

print("Do Nothing")

}

Xcode 7.3 -- Cannot fold switch statements
 
 
Q