Contents
  1. 1. Find good Xcode plugins

I list here some good references that teach how to build your own Xcode plugin. The best way to build an Xcode plugin is to learn from some with the same functionalities

Find good Xcode plugins

Just search on Google and you’ll find a lot. Some are nice to curate the lists

  1. Xcode Plugins - NSHipster
  2. My favorite Xcode plugins
  3. Best Xcode plugins
  4. Xcode Plugin Listing – Quality Xcode Plugins
  5. Complete (more or less) list of Xcode plugins
  6. A Few Helpful Xcode Plugins
  7. Alcatraz Alcatraz is an Xcode plugin that manages Xcode plugins

You can also learn from my plugin XcodeWay, which is very simple. It just contains menu items and actions

Tutorial

blackdogfoundry has some very good tutorials on creating Xcode plugin. Check it out
The only thing he missed is the DVTPlugInCompatibilityUUIDs in your Info.plist

1
2
3
4
5
6
7
8
<key>DVTPlugInCompatibilityUUIDskey>
<array>
<string>AD68E85B-441B-4301-B564-A45E4919A6ADstring>
<string>A2E4D43F-41F4-4FB9-BB94-7177011C9AEDstring>
<string>63FC1C47-140D-42B0-BB4D-A10B2D225574string>
<string>37B30044-3B14-46BA-ABAA-F01000C27B63string>
<string>640F884E-CE55-4B40-87C0-8869546CAB7Astring>
array>

Check it this issue Plugin not loaded in XCode 5.1 to find out more about DVTPlugInCompatibilityUUIDs problem

Also, see the talk by Marin (Reference No.8), for more about DVTPlugInCompatibilityUUIDs

Private APIs

You sometime need to use private APIs to create Xcode plugin.
For example, Get the path of current project opened in Xcode plugin

1
2
3
4
5
6
7
8
9
10
11
NSArray *workspaceWindowControllers = [NSClassFromString(@"IDEWorkspaceWindowController") valueForKey:@"workspaceWindowControllers"];

id workSpace;

for (id controller in workspaceWindowControllers) {
if ([[controller valueForKey:@"window"] isEqual:[NSApp keyWindow]]) {
workSpace = [controller valueForKey:@"_workspace"];
}
}

NSString *workspacePath = [[workSpace valueForKey:@"representingFilePath"] valueForKey:@"_pathString"];

Some plugin like ShowInGithub use class-dump to generate the header APIs and include them in their Header Search Path, this way, they can work with private APIs more easily

NSTask

NSTask can help you run command as if you run on the terminal, really powerful. I use it a lot

NSTask tutorial

Cocoa programming

Creating an Xcode plugin means using a lots of Cocoa APIs. You should have some idea of Cocoa programming

Reference

Contents
  1. 1. Find good Xcode plugins