Skip to content

Commit 6769797

Browse files
committed
Added on load parent application check.
1 parent 9497870 commit 6769797

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

SCXcodeSwitchExpander/SCXcodeSwitchExpander.m

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@ @implementation SCXcodeSwitchExpander
2626

2727
+ (void)pluginDidLoad:(NSBundle *)plugin
2828
{
29-
[self sharedSwitchExpander];
29+
BOOL isApplicationXcode = [[[NSBundle mainBundle] infoDictionary][@"CFBundleName"] isEqual:@"Xcode"];
30+
if (isApplicationXcode) {
31+
static dispatch_once_t onceToken;
32+
dispatch_once(&onceToken, ^{
33+
sharedExpander = [[self alloc] init];
34+
});
35+
}
3036
}
3137

3238
+ (instancetype)sharedSwitchExpander
3339
{
34-
static dispatch_once_t onceToken;
35-
dispatch_once(&onceToken, ^{
36-
sharedExpander = [[self alloc] init];
37-
});
38-
3940
return sharedExpander;
4041
}
4142

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

58-
/*
59-
Since I've got this on Console:<Xcode3FileReference, 0x7fcde7977580 (Represents: <PBXFileReference:0x7fcdeb1018e0:18990B3518D2529C007A8756:name='SCXcodeSwitchExpander.m'>)>
60-
Yes, lazy, and I'm sorry but its 2am and importing XCode Header files is a pain in the ass :P
61-
*/
6259
NSString *fileReferenceStringBulk = [NSString stringWithFormat:@"%@",fileReference];
63-
6460
self.isSwift = [fileReferenceStringBulk rangeOfString:@".swift"].location != NSNotFound;
6561
}
6662

0 commit comments

Comments
 (0)