I've been working on an iPhone app for the past month and am interested in open sourcing some of its code. I built a few categories that others might find useful for generating filler data during testing and debugging, and I also made a view controller for displaying images that others might like to include in their own projects.

How do you go about packaging these types of things (categories, view controllers, etc.) for sharing? What are some naming conventions I should keep in mind? Is it standard practice to preface open source code with initials (EGOTableViewPullRefresh, MGImageUtilities, etc.)? Should I make an example xcode project which shows how they can be used? Should I make a webpage to document and/or promote these things? Is automated documentation generated from comments a good way to go? What sorts of licensing should I be considering?

  • 1
    stackoverflow.com/faq#dontask "Your questions should be reasonably scoped. If you can imagine an entire book that answers your question, you’re asking too much."
    – MacDev
    Nov 10 '11 at 15:34
  • I understand how I might be skirting that line, but I think I've reasonably scoped the question by asking more specifically at the end.
    – awfullyjohn
    Nov 10 '11 at 15:37
  • @awfullyjohn I think, 0x8badf00d is referring to the licensing. This cannot only fill a complete book, but make the living of many lawyers. Nov 10 '11 at 15:40
  • @vikingosegundo oh, ok. yeah, if that is too large of a concept to be asking, I can take that out.
    – awfullyjohn
    Nov 10 '11 at 15:42
  • I think this question can be split to some more smaller questions.
    – MacDev
    Nov 10 '11 at 15:48

I really like when open source projects have SIMPLE easy to use demo projects. I also really like when they have detailed instructions of how to get the stuff working (header files you need, frameworks you need to include, etc.)

Prefixing your classes with initials is how people get around objective-c's lack of namespaces. If you're building a REST framework and you call everything a PostRequest or a GetRequest, odds are good you'll conflict with something. So if you prefix it with your initials or your company's initials, you probably won't conflict.


I am just dealing with these issues myself, as am developing an open-source objective-c lib. I went with the naming convention thing and think you should too, since it allows users to quickly separate your code from theirs and makes the project look more uniform. Most successful projects that I see on Github, do have sample projects and I know plenty of people who want to something in action, especially if it is UI focussed, before they will use it.

Documentation is must.

The biggest issue you will face is the license, assuming you want your code to be usable on the App store. You probably are going to have to go with a more permissive BSD-esque license instead of say the GPL.


To be useful for other developers, OSS needs to be well-documented, and giving example code/projects is such a documentation.

If you need a webpage depends on how big your codes are. i.e. for Three20 it is necessary, while for few categories the readme or a doc folder should be enough.

About licensing: I prefer the WTF License. I released some NSArray categories under this license.

  • Or even really good comments, for small stuff.
    – Wevah
    Nov 10 '11 at 16:08

Apple has published a Coding Guidelines for Cocoa that explains naming and coding conventions etc. when developing a framework or public API.

GitHub is a good place to share the code and it´s free for open source projects. You can have a look at the license that is used for the other open sources there.

Hope this helps :)