iphone - Using enum and switch case combination in Swift -


here code:

enum gamescreen {     case ksceneflashscreen     case kscenemainmenu     case kscenegamescreen     case kscenestorescreen     case kscenegameover }  class ysgamemanager: nsobject {      func replacegamescene(inscreen: gamescreen)     {         switch inscreen         {             case gamescreen.kscenegamescreen: //error here             case gamescreen.kscenemainmenu : //here error           }     } } 

eror log: 'case' label in 'switch' should have @ least 1 executable statement

how use enum in switch case in swift ?

there's error because haven't got after : , before next case. solve can:

1. add code something.

2. add fallthrough if want move next case. may have been trying do. however, in swift, switch statements don't fallthrough default next case, break.

3. add break stop switch statement.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -