moredip/Frank — pull request #150 by MichaelBuckley (2012-11-17 19:49:26+00:00)
Title: Mac Static Libraries

This change adds OS X static library targets for Frank and CocoaHTTPServer. The Frank static library for Mac is still very incomplete, and some methods do not work properly. However, it contains all of the changes to the existing code required to allow Frank to compile on both iOS and OS X.

I am sending this pull request to solicit feedback on the approach I've taken to convert Frank into a multi-platform codebase. My goal was to make it as easy as possible to maintain support for both platforms going forward.

Cocoa and Cocoa Touch contain some classes which function almost identically, but have different names (e.g. NSFont and UIFont, NSColor and UIColor). Where necessary and possible, I converted pointers to these objects to ids. This means that we lost some compile-time type checking, and in places I had to convert dot syntax into explicit method calls. The upside is that the code works on both platforms.

In places where Cocoa and Cocoa Touch differ, I separated the code with the TARGET_OS_IPHONE macro. I attempted to do this as granularly as possible, so that it is easy to see when one is editing code for one platform and consider whether or not the code for the other platform needs to be updated as well.