Reputation: 63442
I've been looking all over the place but I can't find anything. Does anyone know how to create an Xcode 4 plugin?
Upvotes: 46
Views: 18151
Reputation: 29552
As far as I know there is no official way to create Xcode 4 plugins (just like there wasn't one for v3.x).
Here is an openradar on Xcode's lack of plugin support:
Please support the ability for 3rd parties to extend Xcode via a public plugin API. Aperture, Visual Studio, Eclipse, TextMate and other applications benefit from this ability. I would like to see more advanced refactorings, code analysis (think Resharper by Jetbrains) and modeling.
Please dupe this if you want plugins!
Edit: Just stumbled upon this:
Cédric Luthi: "Xcode 4 does support user-defined plugins, see CLITool-InfoPlist for an example of a working Xcode 4 plugin. You just have to add XC4Compatible (true) in the Info.plist."
https://github.com/0xced/CLITool-InfoPlist
That being said these GitHub repos might be handy, too:
Xcode4 Plugin-API Documentation (link dead)
Xcode Plugin Template (link updated)
Further more mogenerator's Xmod plugin might be a good starting point.
(Wasn't Xcode-4 compatible yet, last time I checked, though)
Upvotes: 53
Reputation: 5969
Yesterday ColorSense for Xcode 4 was released on Github. Since the code is really compact spread over just 3 classes, I think you should take a look over there.
Upvotes: 3
Reputation: 5327
Best way to learn is to look at github plugin code (see long list below):
Because its not an official standard I noticed each sample loads in different ways.
XCODE PLUGIN SAMPLES
compiled by either searching github/web for
'DVTSourceTextView'
This is the Xcode Editor window class name
or
Info-list key
'XC4Compatible'
https://github.com/omz/ColorSense-for-Xcode
https://github.com/ciaran/xcode-bracket-matcher
- uses a ruby parser run as pipe!
https://github.com/joshaber/WTFXcode
https://github.com/0xced/NoLastUpgradeCheck
http://code.google.com/p/google-toolbox-for-mac/downloads/list
see GTMXcode4Plugin
https://github.com/DeepIT/XcodeColors
https://github.com/0xced/CLITool-InfoPlist
https://github.com/sap-production/xcode-ide-maven-integration
https://github.com/ciaran/xcode-bracket-matcher
TO GET TO THE NSTextView that is the console
https://github.com/sap-production/xcode-ide-maven-integration
- (NSTextView *)findConsoleAndActivate {
Class consoleTextViewClass = objc_getClass("IDEConsoleTextView");
NSTextView *console = (NSTextView *)[self findView:consoleTextViewClass inView:NSApplication.sharedApplication.mainWindow.contentView];
if (console) {
NSWindow *window = NSApplication.sharedApplication.keyWindow;
if ([window isKindOfClass:objc_getClass("IDEWorkspaceWindow")]) {
if ([window.windowController isKindOfClass:NSClassFromString(@"IDEWorkspaceWindowController")]) {
id editorArea = [window.windowController valueForKey:@"editorArea"];
[editorArea performSelector:@selector(activateConsole:) withObject:self];
}
}
}
return console;
}
Upvotes: 7
Reputation: 1515
Have a look at this new plugin: https://github.com/sap-production/xcode-ide-maven-integration. Maybe you can derive some concepts for your plugin.
Upvotes: 4
Reputation: 11
No, Xcode doesn't support plugins, alternatively you may try AppCode, another IDE for iOS/MacOS, it does support plugins development.
Upvotes: -3
Reputation: 55106
Xcode does not have a public plug-in API.
This was the case with earlier versions, and is the case with Xcode 4 as well.
Upvotes: 2