App-to-app communication with Bonjour
Wednesday, June 6, 2012 at 7:46PM
Kevin Conner in Level Editor, Source Code

Last time I wrote about my plans for Degrees's level editor. I wanted the editor to act as a server so the game could be used to preview the level live. So I needed my iOS app and Mac app to communicate and send Cocoa objects over wifi, preferably with no configuration. Bonjour came to mind, and I set to work learning about it and implementing a client-server system.

It works! The level editor can push a new level to the game at will, and in about a second the level appears on the screen. Animation never skips a beat. I'll be able to make minor adjustments to the level and test them out without a huge load cycle. This also works with multiple simultaneous clients.

As a result of all this, I've produced a library of classes that you can use to set up communication between Mac and/or iOS apps with very few steps. You just need to get the files from Github, drop them into your app, and then follow the instructions.

I gave a talk at a local meetup about all of the above. The organizer was kind enough to post a video of the talk. You can also get my Keynote slides.

(If you've watched the talk, you'll notice that I said there was a major flaw in KCSession. That has since been fixed, so go nuts.)

Article originally appeared on Degrees, a game in progress for iPad and iPhone (
See website for complete article licensing information.