stefanceriu / SCXcodeSwitchExpander

Xcode plugin that enables switch cases autocompletion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect expansion if you cast in the switch

mglidden opened this issue · comments

If you have to cast your int into an enum, SCXcodeSwitchExpander will expand the case statements incorrectly. If you type "(Test)test" in that order, it won't do anything. If you type "test" and then go back and add the cast, it will expand out into this red, green, blue, alpha cases.

typedef NS_ENUM(NSInteger, Test) {
  TestOptionOne = 0,
  TestOptionTwo,
};

@interface TestClass : NSObject
@end

@implementation TestClass

- (void)testMethod:(NSInteger)test {
  switch ((Test)test) {
    case red:
      <#statement#>
      break;
    case green:
      <#statement#>
      break;
    case blue:
      <#statement#>
      break;
    case alpha:
      <#statement#>
    break;
  }
}

@end

Heh, does a similar thing for me using and enum from SCStackViewController.
Thank you for raising it, I'll try to figure out what wrong and fix it this week.

Should be okay now, but please do let me know if you encounter any more issues.