Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsMay 17, 2026·3 min de lectura

CocoaPods — Dependency Manager for Swift and Objective-C

The most widely used dependency manager for iOS and macOS projects, managing library integration through a centralized spec repository and Xcode workspace generation.

Listo para agents

Este activo puede ser leído e instalado directamente por agents

TokRepo expone un comando CLI universal, contrato de instalación, metadata JSON, plan según adaptador y contenido raw para que los agents evalúen compatibilidad, riesgo y próximos pasos.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
CocoaPods Overview
Comando CLI universal
npx tokrepo install 2c61026f-520c-11f1-9bc6-00163e2b0d79

Introduction

CocoaPods is the dependency manager for Swift and Objective-C Cocoa projects. It resolves library dependencies declared in a Podfile, downloads source code, and integrates everything into an Xcode workspace. With a centralized spec repository hosting metadata for thousands of libraries, it has been the standard way to manage iOS dependencies since 2011.

What CocoaPods Does

  • Resolves dependency graphs from a Podfile with semantic versioning constraints
  • Downloads library source code and integrates it into an Xcode workspace
  • Generates Xcode build configurations, frameworks, and header search paths automatically
  • Manages a centralized trunk spec repository with metadata for over 90,000 libraries
  • Supports private spec repos for internal company libraries

Architecture Overview

CocoaPods is a Ruby gem that parses the Podfile DSL, resolves dependencies using Molinillo (a backtracking dependency resolver), and generates an Xcode workspace. Each pod is described by a podspec file containing source location, build settings, and dependencies. The Pods project is generated with targets matching each dependency, and an umbrella workspace ties the main project with the Pods project.

Self-Hosting & Configuration

  • Install via RubyGems: gem install cocoapods
  • Run pod init to generate a Podfile template for your Xcode project
  • Specify platform and deployment target at the top of the Podfile
  • Use pod repo add to set up private spec repositories for internal pods
  • Configure trunk access with pod trunk register for publishing public pods

Key Features

  • Semantic versioning resolution handles complex multi-level dependency trees
  • Static and dynamic framework integration modes for build performance tuning
  • Podfile.lock ensures reproducible builds across team members and CI
  • Pod plugins extend functionality (cocoapods-keys for secrets, cocoapods-binary for pre-built frameworks)
  • Spec repository CDN reduces clone time from minutes to seconds

Comparison with Similar Tools

  • Swift Package Manager — Apple's first-party tool integrated with Xcode; CocoaPods supports more legacy libraries
  • Carthage — decentralized and builds pre-compiled frameworks; CocoaPods offers deeper Xcode integration
  • Tuist — project generation tool that can replace CocoaPods for large-scale Xcode management
  • Gradle (Android) — equivalent dependency manager role in the Android ecosystem

FAQ

Q: Should I use CocoaPods or Swift Package Manager? A: SPM is preferred for new projects with modern dependencies. CocoaPods remains necessary for libraries that only distribute podspecs.

Q: Do I commit the Pods directory to git? A: Either approach works. Committing ensures builds reproduce without network access; ignoring it keeps the repo smaller.

Q: Can I use both CocoaPods and SPM in the same project? A: Yes, they manage separate dependency graphs and coexist in the same Xcode workspace.

Q: How do I publish my own pod? A: Create a .podspec file, validate with pod spec lint, then publish with pod trunk push.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados