Number: 032, Date: 2024-08-12

2024.08.06 ~ 2024.08.11

⚙️ SwiftPM Stability Test


Last week, I completed the migration of the dependency manager in the project from CocoaPods to SwiftPM, and I ran stability tests to check for any new issues.

After finishing the changes, I organized the pros and cons of each dependency manager to see which one would work best in practice.

Typically, iOS projects use three dependency managers: CocoaPods, Carthage, and SwiftPM.

While I also compared Carthage, it was excluded from consideration due to the many libraries it does not support.

Initially, CocoaPods had advantages over SwiftPM, such as supporting both dynamic and static libraries and having broad library support and documentation. However, as of today, many of these advantages no longer apply.

On the other hand, SwiftPM comes with several benefits, including being built into Swift and officially supported by Apple. One notable drawback is that it’s not convenient for non-Swift libraries, meaning I may still need CocoaPods for such cases.

Build Time Analysis

After migrating from CocoaPods to SwiftPM, I measured the build time, as SwiftPM is said to be faster due to skipping dependency checks.

I measured both the initial build time and rebuild time.

Terminal commands for build time measurement:

# Measuring build time for SwiftPM
$ time xcodebuild build -project SwiftPMProject.xcodeproj -scheme SwiftPMProject

# Measuring build time for CocoaPods
$ time xcodebuild build -workspace PAPA.xcworkspace -scheme PAPA

To check the build time in Xcode

$ defaults write com.apple.dt.Xcode ShowBuildOperationDuration -bool YES

However, the results were surprising. Both the initial build and rebuild times were similar, and in some cases, CocoaPods was actually faster.

According to the article 🔗 CocoaPods vs SPM, one possible reason why SwiftPM may have slower build times compared to CocoaPods is that SwiftPM builds all dependencies. If the dependency graph is complex, this can slow down the build process.

🏃 Migrating Git Repository & Batch Updating Git Author


I found a simple way to migrate a Git repository while retaining all commit history.

$ git clone --mirror https://github.com/sookim-1/originalRepo.git

# A .git folder will be created, navigate into it
$ cd originalRepo.git

$ git remote set-url origin https://github.com/sookim-1/newRepo.git

$ git push --mirror

One caveat is that if any single file exceeds 100MB on GitHub, you need to use git-lfs (Large File Storage), which stores large files as text pointers.

For free GitHub accounts, git-lfs storage is limited to 1GB every 20 days. You can upgrade to 50GB by purchasing a $5 data pack.

If you exceed the storage limit, deleting the oversized repository may take some time before the quota resets. In the past, this process had to be manually requested, but with automation, it may have slowed down.

$ git lfs install

# Add the files you want to store with lfs
$ git lfs migrate import --include="Large/*, *.zip" --everything

$ git push --mirror

git-filter-repo

git-filter-repo is a tool that helps filter and modify commit history conveniently.

With this tool, I was able to batch update incorrect author information and remove unwanted files across multiple commits.

🙋🏻‍♂️ Other Notes


  1. I researched how to track the usage of third-party platforms like NHN Cloud and Naver Clova.