diff --git a/SCXcodeSwitchExpander/SCXcodeSwitchExpander.m b/SCXcodeSwitchExpander/SCXcodeSwitchExpander.m index b397dff..84f580c 100755 --- a/SCXcodeSwitchExpander/SCXcodeSwitchExpander.m +++ b/SCXcodeSwitchExpander/SCXcodeSwitchExpander.m @@ -26,16 +26,17 @@ @implementation SCXcodeSwitchExpander + (void)pluginDidLoad:(NSBundle *)plugin { - [self sharedSwitchExpander]; + BOOL isApplicationXcode = [[[NSBundle mainBundle] infoDictionary][@"CFBundleName"] isEqual:@"Xcode"]; + if (isApplicationXcode) { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + sharedExpander = [[self alloc] init]; + }); + } } + (instancetype)sharedSwitchExpander { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedExpander = [[self alloc] init]; - }); - return sharedExpander; } @@ -55,12 +56,7 @@ - (void)editorDidDidFinishSetup:(NSNotification *)sender IDEFileTextSettings *fileSettings = editor.fileTextSettings; IDEFileReference *fileReference = fileSettings.fileReference; - /* - Since I've got this on Console:)> - Yes, lazy, and I'm sorry but its 2am and importing XCode Header files is a pain in the ass :P - */ NSString *fileReferenceStringBulk = [NSString stringWithFormat:@"%@",fileReference]; - self.isSwift = [fileReferenceStringBulk rangeOfString:@".swift"].location != NSNotFound; }