I have created a framework project in Xcode -that has dependency on some pods- to be able to use in different Xcode projects.
How can Xcode be informed to get that framework the dependency it needs?
You have to declare the dependencies on frameworks or on other pods in the podspec file. This file will explain to cocoapods how to correctly bind the pod in your XCode project.
You have an example at the end of the second sample in this page.
Related
I have an Xcode project, consisting of a swift packages, a custom cocoa pods and one target dependency.
In workspace I have:
Project ProfileUtil - xcode project of type Framework. This project contains Firebase SPM dependencies
Project DatabaseUtil - xcode project of type cocoapod. This project contains Firebase pods dependencies
Project MeditationApp - Xcode project of type iOS Application. This is the main application, and it should include ProfileUtil as a framework swift packages, and DatabaseUtil as a Pod
When I try to compile the main iOS application, Im seeing errors like:
Error: Redefinition of module 'Firebase'
module Firebase {
export *
header "Firebase.h"
}
So that got me wondering if I can mix both SPM and Cocoapods in the same project if both uses the same library internally? (I couldn't find any useful ressources online about that use case, which surprise me)
Is there a bypass I could do to fix those, because as in the moment I have to keep my custom pod DatabaseUtil as a cocoapods.
Nope. Firebase does not support being installed from both CocoaPods and Swift Package Manager in the same project. It might be possible to hack into place by hacking the workspace after a CocoaPods install, but it would be fragile.
I want to share framework in another app. I am facing issues when I have some libraries/pods like Alamofire in my framework. what is the solution of this problem? how can i use that library in framework? Also i tried to install Alamofire pod in to the other app in which i have added framework, and tried to access in my framework class but this was not accessible. please guide me how to do it. Thank you
You can use Cocoapods to achieve that. Basically, cocoapods will create a framework for you from the source files that you define and will also install the appropriate dependencies that you define in the target project when the target project does pod install.
Apart from cocoapods, you can also use Carthage which is also a dependency management tool.
You can read more about cocoapods here and how to create a new pod here
Here is my situation:
I am using CocoaPods but I can't use the "use_frameworks!" directive as it is not compatible with ReactNative
I need to include another team's SDK, distributed as a .framework
This .framework depends on PureLayout, which is available through Pods
Hence:
I installed PureLayout through Pods.
I manually linked the other team's SDK dragging it into Embedded Binaries, as per their instructions
Build fails with error Module 'PureLayout' not found. It seems that the other team's framework isn't able to find the PureLayout module included through Pods.
How can I fix? Remember I can't use_frameworks! in Podfile. Thanks.
I'm creating a custom framework which uses Cocoa Pod internally. After installing POD I cannot make use of framework using agreegate target.
I added framework project with my application project just by trag and drop it inside Application project and linked it using Aggregate Target. After installing POD with custom framework, I can not make use the above mentioned way to link framework with my aggregate project.
Thanks
If you are developping a standalone librairy, something that users will have to add manually in their project, you CANNOT use cocoapod in your librairy project. No way! You'll have to provide your users with an install procedure indicating all extra step (framework install, project settings modification, pods to install) they'll have to follow to get your framework up and running.
This is why nowaday people use dependency manager like cocoapods. It makes it easier for users to install their product and install automaticly the dependencies.
If you are planning to distribute your framework thru pod, then follow the recommanded step to create your project architecture and reference in the example project (that uses pods) your dependencies.
I have a project written in Objective-C with libraries. Is it possible to migrate this project to CocoaPods? If yes, please explain how to do this?
Just add CocoaPods to the project usual way. Add your existing libraries to the project using Podfile as well. Then once you update pods , all the libraries will be available in your project under the Pods. Now you can safely delete previous libraries from your project if you had copied them into your project.