Section 2/151 menit
2. Perbedaan Arsitektur Fundamental
2. Perbedaan Arsitektur Fundamental
swift
CocoaPods Architecture:
┌─────────────────────────────────────────────┐
│ MyApp.xcworkspace │
│ ├── MyApp.xcodeproj (project asli) │
│ └── Pods/ │
│ ├── Pods.xcodeproj (generated) │
│ ├── Alamofire/ (source pods) │
│ ├── Firebase/ (source pods) │
│ └── Headers/ (generated) │
│ │
│ Pods.xcodeproj build → libPods.a │
│ MyApp links → libPods.a │
└─────────────────────────────────────────────┘
SPM Architecture:
┌─────────────────────────────────────────────┐
│ MyApp.xcodeproj │
│ ├── Package.resolved (lock file) │
│ └── (package ref dalam project.pbxproj) │
│ │
│ ~/Library/Developer/Xcode/ │
│ DerivedData/SourcePackages/ │
│ checkouts/ (source) │
│ artifacts/ (binary targets) │
│ build/ (compiled) │
│ │
│ Xcode build package → .o files │
│ Link langsung ke app binary │
└─────────────────────────────────────────────┘
Perbedaan Kunci
| Aspek | CocoaPods | SPM |
|---|---|---|
| Maintenance | Community (third-party) | Apple (first-party) |
| Bahasa config | Ruby (Podfile) | Swift (Package.swift) |
| Modifikasi xcodeproj | Ya (generate workspace) | Minimal (reference saja) |
| Binary support | Framework, static lib | .xcframework binary targets |
| Private library hosting | Git, HTTP, local path | Git, HTTP, local path |
| Script hooks | pre_install, post_install |
Build tool plugins |
| Resource bundling | resource_bundles di podspec |
resources di Package.swift |
| Conditional deps | subspecs |
conditional() targets |
| Resolution algorithm | CDN + git | git tags/branches/commits |
| Swift Concurrency support | External concerns | Native |
| Apple Silicon native | Workaround (arch -x86_64) |
Native |