I want to develop a program that relies on plugins (here: loadable bundles) to work. Multiple plugins are asked to use the same AFNetworking ressource to make network requests. However, I don’t know where to put AFNetworking and CustomPluginProtocol headers.
Here is how my program structure looks like for now:
MyApp.xcodeproj
- AFNetworking
- Header.h
- Plugins
- Plugin1.xcodeproj
- PrincipalClass.m
- Plugin2.xcodeproj
- PrincipalClass.m
- Classes
- CustomPluginProtocol.h
- MainClass.m
Of course, every principalClass from PluginN complies to the CustomPluginProtocol.
- Do the headers have to be copied in each bundle ?
- Can I just include the main program
AFNetworkingheaders from my plugins ? If so (and that’s what I do for now), I don’t have any completion. How can I get it ?
Edit
Ok, so maybe I wasn’t clear in my question.
I want my plugins to use sources from the main application, let’s say CommonClass.m and CommonClass.h. Do the plugins need CommonClass.h in their bundle, and if not, how do I enable completion when I’m in the plugin scope ?
You have 2 options:
1) Produce a framework which includes the headers in
<Your Framework>/Headers/2) Simply give out the headers to developers
I prefer option 1 as it’s easier to understand and keep track of everything, but apps like Photoshop use option 2 all the time, so it’s perfectly viable. With Option 1, developers would add the framework you make to their Xcode project, and the would
#include <FrameworkName/HeaderName.h>. With option 2, you would give them a folder of headers and they would put it someplace that’s convenient for them and then would add that to their header search paths and#include "FolderName/HeaderName.h".