I have a 3rd party framework I'm linking to my iOS folder, not a plugin, which I manually have to add back into the iOS project after I run pod install.
Is there any way I can persist the framework reference?
I thought I would need to create a podspec file for the framework, however, I have no idea how to tie the back into the podfile in the root of the iOS directory.
The project folder looks like this:
- MyFlutterApp
- ios
- OtherCompany.xcframework
Then in XCode, I add this to Pods->Frameworks manually; however, every time I need to run pod install, it removes the reference in XCode
Related
I have an existing project which uses Cocoapods, but I would like to switch to SPM; unfortunately I still have dependencies which aren't available in SPM.
Now I would like to move as many dependencies as possible over to SPM and keep the others in Cocoapods as long as necessary - is this possible? Having both, Cocoapods and SPM?
I just tried CocoaPods with SPM on my iOS project and it works fine.
I'm adding Firebase and other Google libs using CocoaPods and the rest using Swift Package Manager.
When adding SPM dependency, put checkmark on your project(s) and not on the Pods project.
Xcode 11.5,
CocoaPods 1.9.3.
After trying it out I found you can actually have a SPM + Cocoapods to play nice. You install your SPM library on the .xcodeproj while you develop on the .xcworkspace. It all works (at least so far for me lol).
If you are using CI, or you launch manually from xcodebuild command some tweaks with the -clonedSourcePackagesDirPath flag
I have had used swift package manager at the beginning and added 4 packages in my project. When I had to integrate admob sdk. I added cocoapod to my project.
but after open the .xcworkspace file. the packages status are display as Missing. I have to add them from SPM one by one. after all 4 packages were added again. the project can be built and executed again.
Considering all the pros and cons, I found it suitable to use CocoaPods as SPM is still at a very nascent stage and not all libraries support it.
Please go through the blog written by Darshan Patel by https://blog.kiprosh.com/preferable-dependency-manager-swift-package-manager-spm-or-cocoapods/ for more details.
Since I'm building using FireStore and few other Firebase library, the build time has doubled down. I'm wondering if there is a way to avoid compiling it every time I clean & build my project.
Don't clean & build, just build. ;)
Disclaimer: Before doing releases, a clean build is preferred, of course.
UPDATE with better answer: Use cocoapods-binary plugin.
https://guides.cocoapods.org/plugins/pre-compiling-dependencies.html
One solution for this is to not give Xcode the chance to re-compile code. CocoaPods Binary will pre-compile your Pods during pod install, and then add the binary assets (e.g. .framework files) into the generated Xcode projects instead of the source code.
Like this.
plugin 'cocoapods-binary'
use_frameworks!
target "MyApp" do
pod "NeededPod", :binary => true
end
For anyone stumbling on this post, we finally found a way to optimize Firestore build time while still using cocoapods.
We are using THIS REPO
It's a precompiled Firestore iOS SDK xcframework files extracted from the Firebase iOS SDK repository release downloads, tagged by Firebase iOS SDK version and presented as a consumable podspec.
Why
Currently the Firestore iOS SDK depends on some 500k lines of mostly C++, which when compiling as part of your Xcode build takes a long time - even more so in CI environments.
I'm using cocoapods in xcode for few frameworks (Firebase extensions, fabric, facebook sdk etc). The moment I generated the workspace, it take too long to compile and makes it very difficult to work on the project.
I'm looking for a solution where I can temporarily disable the frameworks that are added through pod.
I have been trying few ideas but all of them have their drawbacks.
1) Remove the pods and update the repo (but it has to download all the pods again)
2) Make a backup of pod folder and create a temporary pod file with very limited frameworks (Pod always try to download the selected frameworks even if they're present in the folder)
3) Remove the frameworks from dependencies (This still compile the frameworks as they're added as a separate project in the workspace)
I have recently been working with Cocoapods on my own projects, and would like to incorporate a couple of pods into a project at work. The problem is that our code consists of close to 20 projects stored inside a large workspace, sorted into folders. The structure of the projects is
Workspace
Apps (Folder)
Project 1
Project 2
etc...
Modules
More Projects
etc
Base Components
Even More Projects
etc
I am unsure how to write a podfile that would link a pod (RETableView in this case) against an app without disturbing the existing structure of the workspace? Is this even possible? If it isn't possible to incorporate cocoapods without changing the existing workspace, is it possible to set up cocoapods to compile pods as standalone libraries that I could incorporate into our project?
With CocoaPods 1.x you can use :integrate_targets => false in your Podfile like this:
install! :integrate_targets => false
You can find the documentation for this here
Previously (for older CocoaPods versions):
After creating your Podfile use pod install --no-integrate documented here. This will create the Pods project that you can then include in your workspace. Please make sure everything in your project is checked into your version control system first just in case anything goes wrong.
I am considering using CocoaPods on an existing iOS project.
However I got confused when I read the installation instructions, which say:
Make sure to always open the Xcode workspace instead of the project
file when building your project:
$ open App.xcworkspace
I have no idea what they want to tell me with that. I know there is a .xworkspace file within the .xcodeproj bundle.
But does that mean I can never again simple double click on my .xcodeproj file? Can I no longer open the project from the XCode recent items menu? And do I always need to open it from Terminal?
The concept of CocoaPods sounds interesting, but I don't want to mess with XCodes internal project structure...
A workspace is like a step up from a project. It can contain several projects. When you install Cocoapods on your project, it creates a workspace which contains your original project and a new Pods project which contains the code from the pods you are using.
It also creates dependencies between your project and the pods project (since your project needs the pods project to be built before you can build your own, it has to look for the headers, etc.). Because of this, if you subsequently open the project file instead of the workspace file, it will fail to build because it doesn't have the right information about the Pods.
The change doesn't really affect anything about the way you work - just double-click the workspace file instead of the project file, and the workspace will subsequently show up in your recent items list.
You don't need to open it from the terminal, that guide is just there because you would have installed the pods from the command line, so it is a convenience to then open the workspace file immediately from there.