I have my own Xcode project which contains some controllers. I want to make its SDK, for use it in another application. In parent application it works as child. Parent app will share some data with my controller and my controller works on it and gives back some result. So kindly guide for me. Examples are - Payment Gateway SDK's. I am looking for the same.
1 Answers
I can see you add tag for swift. In Swift, static libraries are not supported, so you must exclusively use a framework (aka dynamic library) when linking an app to a library. Framework is similar to sdk.
Here are the steps:
1)Create the Framework using New > Project under IOS > Framework & Library, select Cocoa Touch Framework
2)To avoid the "ld: warning: directory not found for option..." goto Library Search Paths in Build Settings for your target and delete the paths.
3)You can't mix Objective-C with Swift so don't even consider adding the Swift-Header bridge file in your code.
4)There are some cases in swift where you need to import code from unexposed Frameworks. I've successfully used the module-map inside the framework to deal with these case.
5)I also select CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES in the Build Settings to solve 'include of non-modular header inside framework module'. That seems to work
6)I make sure that the header file that gets generated is marked as Public (not Project). Click on the file and you'll see the selection in the inspector under 'Target Membership'
Also you can follow this tutorial. Since you have already created project. Create a framework target, make all source code files a member of the new target, add the new target as target to the podfile. For everything else the tutorial should work. It should help you in understanding the steps. Build framework

- 3,147
- 3
- 15
- 28
-
i am getting this error **using bridging headers with framework targets is unsupported** – Mayur Shinde Sep 11 '17 at 09:19
-
this is error for my framework. I had some controllers in Swift and another are in Objective C. – Mayur Shinde Sep 12 '17 at 05:19
-
done with my framework using objective c itself. Now i want to know how to call my controller which is in SDK. I am use my own SDK in my another Swift Code. – Mayur Shinde Sep 14 '17 at 08:47
-
Congrats for getting it working.You have to show what have you done so far to get better help. Also this seems like a separate question you asked here. You an post a new question with your problem. The solution for your problem is to drag and drop the folder containing framework files and add create folder references. And then browse it in Linked Framework and Libraries and it will show itself as framework than a folder. Hope it helps – cole Sep 14 '17 at 08:52
-
If you are happy with answer please accept it and upvote it :) – cole Sep 14 '17 at 08:53