CoPilot – Collaborative editing for Xcode

CoPilot is an Xcode plugin for collaborative editing. The source code is available on GitHub and you can download the latest release from the GitHub releases page.

However, the easiest way to get started is to install it via the following terminal command:

curl -fsSL https://raw.githubusercontent.com/finestructure/CoPilot/master/Misc/install.sh | sh

While CoPilot has worked reliably in my own testing, there is only so much you can do to test a collaborative editor as a single user. Please help me by giving the plugin a try and reporting back any issues you may find via the GitHub issue tracker.

Please consider this initial release an early beta which currently has a couple of known limitations:

  • Undoing changes sometimes leads to crashes. This is caused by selections on invalid regions. For manual edits this is taken care of by the plugin but for the undo manager this is not so easy, because the changes happen directly between NSTextStorage and NSUndoManager.
  • Server changes win in case of conflicts. CoPilot tries its best to merge changes that are happening at the same time. In case of simultaneous edits, it uses diff3 to try to do the merge. If this fails, i.e. if the merge results in conflicts, the server wins and the client changes are overwritten.
  • Playgrounds only share code sections, not markdown. Playgrounds with markdown sections appear to have multiple views representing the document. You can share the code sections of it by making sure your cursor is in one of those before publishing the document. The receiver will see all the code sections stripped of the rich text sections and editing will work. Alternatively, you can share the text representation by selecting “Editor” / “Show Raw Markup” before publishing the document.

Compatibility

CoPilot has been tested on Xcode 6.3.2, 6.4, and 7beta. It should also run on other versions of Xcode.

Quick user guide

The CoPilot plugin adds three menu items to the “Edit” menu:

  • Publish
  • Subscribe
  • Show Connections

Publish allows you to make the currently active editor window available as a shared document and advertises it via Bonjour. The communication channel used is a WebSocket. The service runs on port 8137 and this is currently not configurable.

Subscribe opens a sheet for the currently active editor window and shows published documents available via Bonjour. Selecting a document and clicking the “Subscribe” on the sheet will connect to the remote document and overwrite everything in the current editor window.

As of version 0.8 the connection can also be established by specifying a URL (essentially a hostname or IP, as the protocol and port are fixed). To do so, click the “Enter URL…” button on the subscribe sheet.

Show Connections opens a utility window showing the active connections for the current window. For a published document this will list all the remote clients connected to this document. For a subscriber this will only show a single entry, which is the document this window is subscribed to. At the top of the window a status indicator shows if the document has an active connection or is published.

How to install manually

While the one line install shown above is the easiest way to get CoPilot you can also install it manually. Do do so, download the latest plugin from the GitHub releases page and place it in

~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins

Simply create the folder hierarchy if it doesn’t exist yet.

Feedback

I’m extremely grateful for any sort of feedback I can get about CoPilot. You can reach me at [email protected].

CoPilot started from a crazy idea when my colleagues and I struggled to ‘remote control’ someone typing in a playground during a Swift presentation. I wished we had a Google document with a Swift REPL and from there it turned into a side project that might actually be possible.

As is the nature of side projects it hasn’t received nearly enough attention to be deemed ‘ready’. But I reckon you’re all developers and if you’re into Swift you should be hardened by SourcecodeKit dying on you left, right, and centre. SourcecodeKit came around by now, and hopefully the same will be true for CoPilot as well at some point.