I installed the Realm iOS SDK into my Xcode project using CocoaPods, as described in your documentation. However, I noticed that the Realm CocoaPod has taken up over 500MB of additional space in my project. Upon further inspection, it looks like the “culprit” files are located in Pods/Realm/core/realm-monorepo.xcframework, where each folder inside that realm-monorepo.xcframework folder contains a librealm-monorepo.a that is 30 to 123MB big.
I commit all my CocoaPods into my GitHub repository, so when trying to commit the Realm files to my repo, GitHub told me that one of the librealm-monorepo.a files was so large that it would not allow the file to be included in the repository. It looks like I will need to use Git Large File Storage to accommodate it, which is probably doable but inconvenient.
Do you guys have a particular recommendation for how to handle this large CocoaPod in our project? Is using Git Large File Storage what you’d recommend?
The considerations below are my own, so please take them with a grain of salt…
While the official CocoaPods docs lists the benefits of checking in the Pods directory, I prefer not to check the Pods in, as I’ve found the advantages to be pretty weak. For example, to clone the repo you still need to have an Internet connection, and downloading the Pods binaries isn’t that faster than building them locally - in fact, depending on the connection, it may even be slower.
If you want to check in the Pods, however, the .xcframework are actually build products from Realm Core, that may well be machine- and build-dependant, not part of the source code, so you may want to put that extension in the .gitignore, and have them built fresh for the specific architecture.
@Paolo_Manna Appreciate the response! That’s interesting to know your recommendation to not check in the Pods directory. It seems like the CocoaPods community is pretty split on this issue, but your reasoning makes sense.
Anyway, I did temporarily implement the Git Large File Storage solution I mentioned, but then I noticed that the build time increased by about 3 minutes on our GitHub Actions CI server now that we were building the Realm iOS SDK.
After looking into possible ways to reduce the build time, I decided to switch over to use Carthage instead of CocoaPods, since that way I wouldn’t have to build the dependency binaries on every build. I also decided to not check in the Carthage directory (similar to what you were suggesting for CocoaPods), and instead use GitHub Actions’ caching mechanism to make downloading the Carthage dependencies much quicker.
Hope this helps anyone else experiencing similar issues
Just want to chime in here with a bit more info about the actual SDK download.
There are a lot of additional files and ‘stuff’ that may exist within a project development folder that may not be part of the final project because the SDK may need to support multiple devices.
As mentioned, in the Realm/core/realm-monorepo.xcframework folder, there are supporting files for macOS/tVOS/iOS/watchOS etc, so a lot of extraneous stuff that has nothing to do with the project on your device. If you are not using that part of the SDK, those can be removed to make the project file smaller.
Additionally, the SDK that’s downloaded from github may have a number of example projects and code that can also be removed (saving disk space)