Edit
With the extra context that you were using this inside a switch
statement I know what is wrong.
You can't declare variables inside a switch statement without enclosing the cases in curly brackets. You can read about why this is in this answer (in short, they don't introduce new scopes).
For example, creating a variable like this gives the compiler error that you are facing:

but if you add braces around the case (like below) then you can create variables within that scope

Original answer
There is no problem with the code that you have shown in that question. The following code works for me without any compiler errors:
UIBezierPath *shapePath = [UIBezierPath bezierPath];
CGFloat middleX = 10.0;
CGFloat middleY = 10.0;
CGAffineTransform move = CGAffineTransformMakeTranslation(middleX, middleY);
[shapePath applyTransform:move];
[shapePath stroke];
[shapePath fill];
You should look for other syntax errors in the just above what you have included in your question.
For example, as suggested in this answer, you may be missing a closing bracket (}
) somewhere else in your code.