Search code examples
xcodeenumsswitch-statementsemantics

Error message: Enumeration value 'GameMoveNineEnum' not handled in switch?


I have found questions close, but nothing that helps, can anyone see why I'm geeting this error please? It has an issue with "(move)" Line 6 of the code. Thanks

// move the spirit left/right/up/down
-(BOOL)moveSpiritWidthOrientation:(GameSpirit*)spirit moveEnum:(GameMoveEnum)move setTransform:(BOOL)trans{
    CGPoint gridPoint = [self getGridPointWithPoint:spirit.endPoint];
    CGAffineTransform transform = CGAffineTransformIdentity;
    switch (move) {
        case GameMoveTopEnum:
            gridPoint.y -= 1;
            transform = CGAffineTransformMakeRotation(-M_PI/2);
            break;
        case GameMoveBottomEnum:
            gridPoint.y += 1;
            transform = CGAffineTransformMakeRotation(M_PI/2);
            break;
        case GameMoveLeftEnum:
            gridPoint.x -= 1;
            transform = CGAffineTransformMakeScale(-1, 1);
            break;
        case GameMoveRightEnum:
            gridPoint.x += 1;
            break;
    }

Solution

  • Use default. Even default: break; will do.