4

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 AFNetworking headers 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 ?

ldiqual
  • 15,015
  • 6
  • 52
  • 90
  • Headers files doesn't get added to the bundle. Unless you are adding a file as a resource. – Black Frog Jul 06 '12 at 17:34
  • Each plugin project that need AFNetworking would link against that library. – Black Frog Jul 06 '12 at 17:39
  • `AFNetworking` is not a real library as it is not compiled separately from my main application. It's just a bunch of files in a folder. How to make `PluginN` see `AFNetworking` headers properly ? – ldiqual Jul 06 '12 at 17:42

1 Answers1

0

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".

user1118321
  • 25,567
  • 4
  • 55
  • 86