I fell in love with Cocoapods and I want to migrate all my projects with it.
Before doing it, I've a few questions on how to handle external not-cocoapods frameworks in my projects.
1) Let's say that I'm using Cocoapods and I've included only AFNetworking framework.
At some point, I need to use some CoreGraphic animation and I need to use QuartzCore: AFNetworking is not using this framework, so QuartzCore is not included in my Pods project.
What's the best way to handle this situation?
Is better to think "I put all the frameworks in my Pods project, so in my "app project" I've only the code necessary to my app"? And if yes, how? Adding in my Pods.xconfig this code
OTHER_LDFLAGS = -ObjC ... -framework QuartzCore
? Or there are other (better) ways?
Or is better to think "this is not a Pod, so I add the framework on my "app project" as I've always done before"?
2) I've a library (saved in my HD) that is not on the main repository of Cocoapods and there is no Podspec file: what's the best way to include it on my project?
I create a podspec for that library and I link it using :local attribute on my Podfile
I add that library in my "app project" as I've always done
Of course every way works fine, so I'm not asking "How to add an external framework", I'm asking what's the best way to do it :)
Framework
CocoaPods tries, to the possible extent, to separate its files from your work. This is also needed because CocoaPods needs to control some files. For example the Pods.xcconfig is assumed to be under CocoaPods control and it is recreated during each installation. In other words any change that you make to it is lost.
So if you need a framework you should add it to your app project. In principle you should do it even if the framework is included by some Pods because they might be updated removing the dependency and your project would break.
Custom library
Both alternatives work, if you plan to reuse the library creating the podspec might come handy in future. You could also create a custom repo (see the wiki) so you don't need to use the :local option.
Related
I have created one XCframework which needs to use other pod dependencies like Alamofire.
Apple suggests not using an umbrella framework then what is the workaround when we have a situation like this?
I'm not a big fan of cocoa pods, and are trying to modernise a project, getting rid of all the cocoa pods for a start, and #flurry is one of them. is there a Swift Package manager implementation of #flurry
I don't think so no. Swift package manager is comparatively new so it would take time for developers to port their cocoapods to SPM. But, there is already a request to add SPM support that has been closed, due to the unavailability of support to add binary in SPM. Check this link.
I have created custom frameworks to use in my current iOS app.
profileManager.Framework
messagemanager.Framework
requestManager.Framework
Now both profileManager.Framework & messagemanager.Framework are actually using requestManager.Framework methods so what I want is that in my Xcode project of app I only want to keep only one physical copy of the requestManager.Framework code.I want that my request manager code should have only one copy per app and the reference should be linked with other framework.
We have created this frameworks on local machine & now my problem is we can't add dependencies in profileManager.Framework or either in messagemanager.Framework. I want to know that how it can be possible that my both framework will use network manager from app with a single copy of its in application.
Have that framework at your single view application level and make sure the framework path is given correct in build settings of App and as well as Framework.
This way you maintains only one copy of framework that too at Project level and feel free to use in Project or Project Framework level.
How about trying to manage the dependencies of those frameworks with CocoaPods?
In the podspec of UserManager.Framework and InboxManager.Framework , configure the dependencey like s.dependency 'NetworkManager', '~> 1.0'. In this way, you can have only one physical copy of the NetworkManager.framework code in your app.
For example, AlamofireImage and Alamofire-SwiftyJSON both have the dependency on Alamofire but only one physical copy of the Alamofire.framework installed in the app with running pod install.
Reference: AlamofireImage.podspec, Alamofire-SwiftyJSON.podspec
I saw the similar issue in stackoverflow, and add --use-libraries after pod spec lint. It just says
[!] Pods written in Swift can only be integrated as frameworks; this feature is still in beta. Adduse_frameworks!to your Podfile or target to opt into using it. It very strange.
My question is how to create a framework which is written in objective-c and swift, and create a private cocoapods repository. I cannot create a correct .podspec because I use objective-c bridging header in framework, and pod spec lint always tell me error: include of non-modular header inside framework module. This makes me gonna be crazy...
I also post this issue in detail in github:
https://github.com/CocoaPods/CocoaPods/issues/3666
If anyone knows how to fix it, I'll be very appreciate for you. Thanks a lot!
I want to develop an chat application, in which I successfully added files of DDXML, DDXMLElement, DXMLElementAddition etc., now I need to add XMPP framework files and its libraries, where do i find these files, is there any open source of these files?
I checked the site http://code.google.com/p/xmppframework/wiki/iPhone in which they mentioned which files to be added, but I didnt find those files to include in my project,
if anyone knows please tell me..
Thans in advance...
I think the google repo is officially moved to git at https://github.com/robbiehanson/XMPPFramework
Do you mean the XMPP sources?
Here they are:
http://code.google.com/p/xmppframework/source/checkout
You have to checkout the sources manually, that is the easiest way, or you browse the repository and save all files:
http://code.google.com/p/xmppframework/source/browse/
Other libs are described. AsyncSocket is this one:
http://code.google.com/p/cocoaasyncsocket/source/checkout
Here are their files for the project:
http://code.google.com/p/xmppframework/source/browse/?r=default#hg%2FXcode%2FiPhoneXMPP
And in your XCode project the framework you need to add is CFNetwork
So right click on your Frameworks folder in XCode
Add > Existing Frameworks > Select "CFNetwork"
and everything should be ready to run their iPhone XMPP example.