Reputation: 9979
I'm creating a static Framework to distribute to other projects. I have some confusion with the design approach for building the framework. I have never built a framework before.
I'm building something similar to AdColony framework where I'll pass some unique id to framework and it will internally call several APIs and it will transfer final output back to the application with proper delegates. And in that AdColony framework only one .h file is public.
I'm wondering some questions:
1) I'm planning to use AFNetworking for all server communication and parsing. So while building framework how I can link my static framework with AFNetworking. AFNetworking headers will be visible in final .framework output ? If external AFNetworking linking is required to my framework so is it a good approach that I'm forcing other developers to include AFNetworking ? Or i have to write down my own basic networking layer ?
2) Can I hide my all wrapper and Model classes and just make 1 class visible to developers for configuration and handling output ?
Apart from above questions if you have some best design approach for building this framework then please do suggest.
Upvotes: 1
Views: 408
Reputation: 1889
Add AFNetworking to your framework. And set the header of the AFNetworking like public headers. You could change some include to create a clean include headers.
Link your framework with AFNetworking, and force other developer to link AFNetworking.
How to know which approach to follow?
I would use the first approach if my framework will provide some Network Layer. And I will maintain my project. The second approach is useful if you only use AFNetworking for your internal implementation. But you will need maintain your framework when AFNetworking change something that you are using.
You can set public headers. So, if you want to have only one public class you need to set that header as public. Remember that all the method in the .h are public. So if you want to ensure that no one can call your method, you need to put the method declaration in a category that you will use in your .m
Another suggestion: take a look to this project.
Upvotes: 2