Skip to content

Commit

Permalink
Added on load parent application check.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Jul 5, 2015
1 parent 9497870 commit 6769797
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions SCXcodeSwitchExpander/SCXcodeSwitchExpander.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -55,12 +56,7 @@ - (void)editorDidDidFinishSetup:(NSNotification *)sender
IDEFileTextSettings *fileSettings = editor.fileTextSettings;
IDEFileReference *fileReference = fileSettings.fileReference;

/*
Since I've got this on Console:<Xcode3FileReference, 0x7fcde7977580 (Represents: <PBXFileReference:0x7fcdeb1018e0:18990B3518D2529C007A8756:name='SCXcodeSwitchExpander.m'>)>
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;
}

Expand Down

0 comments on commit 6769797

Please sign in to comment.