I'm developing an objective-c framework based off Cocoa touch and am looking at other frameworks for parsing data, both for JSON and XML.
I want to be as easy for the developer using to use my framework out of the box and am wondering what the best way to include third party frameworks conditionally. I want to give credit where credit is due, so I don't want to include the other projects with the distribution, but I'd like the developer be able to add a framework (or even just a bunch of classes) like SBJson or Touch XML and have my codebase to see the included codebase and use it with the added functionality it provides. Enabling the framework through some kind of config file, or in the project settings is also an option, but is less ideal.
What is the best way to do this with the compiler settings? I have seen a lot of developers switching included frameworks from "Required" to "Optional", but I don't think either SBJson or Touch XML are compiled down to or implemented using an objective-c framework package (.framework) or a C static library (.a) and thus wouldn't be able to take advantage of this.
How would one conditionally implement this in code? For instance
SBJson's header is imported via a #import "SBJson.h"
compiler
directive, but this will fail if the required header isn't found.
You can include the .h but when using an object from it you need to call it with NSClassFromString
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With