### Verify Private Repo Installation Source: https://guides.cocoapods.org/making/private-cocoapods Navigate to the local repository directory and run linting to ensure the setup is correct. ```bash $ cd ~/.cocoapods/repos/REPO_NAME $ pod repo lint . ``` ```bash $ cd ~/.cocoapods/repos/artsy-specs $ pod repo lint . ``` -------------------------------- ### Configure CocoaPods Installation Options Source: https://guides.cocoapods.org/syntax/podfile.html Use the `install!` command to specify installation methods and options for CocoaPods. This example configures custom options like `:deterministic_uuids` and `:integrate_targets`. ```ruby install! 'cocoapods', :deterministic_uuids => false, :integrate_targets => false ``` -------------------------------- ### install! Root Option Source: https://guides.cocoapods.org/syntax/podfile.html The install! directive specifies the installation method and configuration options for the Podfile. ```APIDOC ## install! (Root Option) ### Description Specifies the installation method and options to be used when CocoaPods installs the Podfile. Currently, the only supported method is 'cocoapods'. ### Parameters #### Request Body - **method** (string) - Required - The installation method (currently only 'cocoapods'). - **options** (hash) - Optional - Configuration keys for installation behavior. ### Supported Options - **:clean** (boolean) - Default: true - Whether to clean pod sources. - **:deduplicate_targets** (boolean) - Default: true - Whether to deduplicate pod targets. - **:deterministic_uuids** (boolean) - Default: true - Whether to generate deterministic UUIDs. - **:integrate_targets** (boolean) - Default: true - Whether to integrate pods into the user project. - **:lock_pod_sources** (boolean) - Default: true - Whether to lock pod source files. - **:warn_for_multiple_pod_sources** (boolean) - Default: true - Warn if multiple sources contain the same pod. - **:warn_for_unused_master_specs_repo** (boolean) - Default: true - Warn if master specs repo is used instead of CDN. - **:share_schemes_for_development_pods** (boolean) - Default: false - Whether to share Xcode schemes for development pods. - **:disable_input_output_paths** (boolean) - Default: false - Disable input/output paths for script phases. - **:preserve_pod_file_structure** (boolean) - Default: false - Preserve file structure for all pods. - **:generate_multiple_pod_projects** (boolean) - Default: false - Generate a project per pod target. - **:incremental_installation** (boolean) - Default: false - Enable incremental regeneration of targets. ### Request Example install! 'cocoapods', :deterministic_uuids => false, :integrate_targets => false ``` -------------------------------- ### Complex Podfile Example Source: https://guides.cocoapods.org/syntax/podfile.html An example of a more complex Podfile demonstrating platform specification, warnings inhibition, nested targets, and post-install hooks. ```ruby platform :ios, '9.0' inhibit_all_warnings! target 'MyApp' do pod 'ObjectiveSugar', '~> 0.5' target 'MyAppTests' do inherit! :search_paths pod 'OCMock', '~> 2.0.1' end end post_install do |installer| installer.pods_project.targets.each do |target| puts "#{target.name}" end end ``` -------------------------------- ### pod try Source: https://guides.cocoapods.org/terminal/commands.html Downloads a Pod, installs its dependencies, and opens its demo project. ```APIDOC ## pod try ### Description Downloads the Pod with the given NAME (or Git URL), installs its dependencies if needed, and opens its demo project. ### Parameters #### Path Parameters - **NAME|URL** (string) - Required - The name of the pod or the Git URL of the repository. #### Options - **--podspec_name** (string) - Optional - The name of the podspec file within the Git Repository. - **--no-repo-update** (boolean) - Optional - Skip running `pod repo update` before install. ``` -------------------------------- ### Checkout branch and install dependencies Source: https://guides.cocoapods.org/using/unreleased-features.html Navigate to the cloned directory, switch to the desired branch, and install required Ruby gems. ```bash cd CocoaPods git checkout swift bundle install ``` -------------------------------- ### Installer Class Install Method Source: https://guides.cocoapods.org/contributing/contribute-to-cocoapods.html This method orchestrates the installation process by calling various sub-methods. It's an example of CocoaPods' convention of using small, focused methods. ```ruby def install! resolve_dependencies download_dependencies generate_pods_project integrate_user_project if config.integrate_targets? perform_post_install_actions end ``` -------------------------------- ### Install a Pod with All Subspecs Source: https://guides.cocoapods.org/syntax/podspec.html Installs a pod along with all its defined subspecs. This is the default behavior when a pod has subspecs. ```ruby pod 'ShareKit', '2.0' ``` -------------------------------- ### Verify User-level Installation Source: https://guides.cocoapods.org/using/getting-started.html Commands to install via user-install flag and verify the installation path. ```bash $ gem install cocoapods --user-install $ gem which cocoapods /Users/eloy/.gem/ruby/2.0.0/gems/cocoapods-0.29.0/lib/cocoapods.rb $ /Users/eloy/.gem/ruby/2.0.0/bin/pod install ``` -------------------------------- ### Track exact pod versions with Podfile.lock Source: https://guides.cocoapods.org/using/using-cocoapods.html This example shows a simple dependency in a Podfile. After running `pod install`, a `Podfile.lock` is generated to record the exact version installed, ensuring consistent builds. ```ruby pod 'RestKit' ``` -------------------------------- ### YARD Documentation Example Source: https://guides.cocoapods.org/contributing/contribute-to-cocoapods.html Example of method documentation using YARD syntax. It includes return value, parameter, note, and example sections, following CocoaPods' documentation standards. ```ruby # @return [Pathname] Returns the relative path from the project root. # # @param [Pathname] path # The path that needs to be converted to the relative format. # # @note If the two absolute paths don't share the same root directory an # extra `../` is added to the result of # {Pathname#relative_path_from}. # # @example # # path = Pathname.new('/Users/dir') # @sandbox.root #=> Pathname('/tmp/CocoaPods/Lint/Pods') # # @sandbox.relativize(path) #=> '../../../../Users/dir' # @sandbox.relativize(path) #=> '../../../../../Users/dir' # ``` -------------------------------- ### Specify Installation Plugins Source: https://guides.cocoapods.org/syntax/podfile.html Configures plugins to be used during the installation process, with optional parameters passed to the plugin. ```ruby plugin 'cocoapods-keys', :keyring => 'Eidolon' plugin 'slather' ``` -------------------------------- ### Install CocoaPods Source: https://guides.cocoapods.org/using/getting-started.html Standard installation command for CocoaPods using RubyGems. ```bash $ gem install cocoapods ``` ```bash $ sudo gem install cocoapods ``` -------------------------------- ### pod setup Source: https://guides.cocoapods.org/terminal/commands.html Sets up the CocoaPods environment. This command initializes the necessary configurations for CocoaPods to function correctly. ```APIDOC ## pod setup ### Description Set up the CocoaPods environment ### Method GET ### Endpoint pod setup ### Inherited Options: - **--allow-root** (boolean) - Allows CocoaPods to run as root. - **--silent** (boolean) - Show nothing. - **--version** (boolean) - Show the version of the tool. - **--verbose** (boolean) - Show more debugging information. - **--no-ansi** (boolean) - Show output without ANSI codes. - **--help** (boolean) - Show help banner of specified command. ``` -------------------------------- ### Configure Sudo-less Installation Source: https://guides.cocoapods.org/using/getting-started.html Environment variables to set up RubyGems for user-directory installation. ```bash export GEM_HOME=$HOME/.gem export PATH=$GEM_HOME/bin:$PATH ``` -------------------------------- ### Setup CocoaPods Environment Source: https://guides.cocoapods.org/terminal/commands.html Initializes the local CocoaPods environment. ```bash pod setup ``` -------------------------------- ### pod plugins installed Source: https://guides.cocoapods.org/terminal/commands.html List all installed plugins and their versions. ```APIDOC ## pod plugins installed ### Description List all installed plugins and their respective version. ### Method CLI Command ### Endpoint pod plugins installed ``` -------------------------------- ### Install Dependencies Source: https://guides.cocoapods.org/terminal/commands.html Downloads dependencies and configures the Xcode project. Requires a Podfile in the directory. ```bash pod install ``` ```ruby project `path/to/XcodeProject.xcodeproj` ``` -------------------------------- ### Execute the local pod binary Source: https://guides.cocoapods.org/using/unreleased-features.html Run the pod install command using the specific path to the local development version. ```bash cd ~/projects/dev/eidolon /Users/orta/spiel/ruby/CocoaPods/bin/pod install ``` -------------------------------- ### Install Subspecs Source: https://guides.cocoapods.org/syntax/podfile.html Installs specific subspecs or collections of subspecs for a pod. ```ruby pod 'QueryKit/Attribute' ``` ```ruby pod 'QueryKit', :subspecs => ['Attribute', 'QuerySet'] ``` -------------------------------- ### Execute Prepare Command for Pod Source: https://guides.cocoapods.org/syntax/podspec.html Define a bash script to run after the Pod is downloaded but before build paths are collected. This command executes in the Pod's root directory. It is not executed if the pod is installed with the `:path` option. ```ruby spec.prepare_command = 'ruby build_files.rb' ``` ```ruby spec.prepare_command = <<-CMD sed -i 's/MyNameSpacedHeader/Header/g' ./**/*.h sed -i 's/MyNameOtherSpacedHeader/OtherHeader/g' ./**/*.h CMD ``` -------------------------------- ### Install CocoaPods with Custom Path Source: https://guides.cocoapods.org/using/troubleshooting Use this command if you encounter permission errors during gem installation. ```bash $ sudo gem install -n /usr/local/bin cocoapods ``` -------------------------------- ### Install or Update Pods Source: https://guides.cocoapods.org/making/making-a-cocoapod.html Use 'pod install' to add new pods to your project or 'pod update' to update existing ones to their latest allowed versions. ```bash pod install -- or -- pod update ``` -------------------------------- ### pod install Source: https://guides.cocoapods.org/terminal/commands.html Downloads dependencies and creates an Xcode Pods library project. ```APIDOC ## pod install ### Description Downloads all dependencies defined in Podfile and creates an Xcode Pods library project in ./Pods. This configures the project to reference the Pods static library, adds a build configuration file, and adds a post build script to copy Pod resources. ### Options - **--repo-update** - Force running `pod repo update` before install. - **--deployment** - Disallow any changes to the Podfile or the Podfile.lock during installation. - **--clean-install** - Ignore the contents of the project cache and force a full pod installation. - **--project-directory** (string) - The path to the root of the project directory. ### Inherited options - **--allow-root** - Allows CocoaPods to run as root. - **--silent** - Show nothing. - **--version** - Show the version of the tool. - **--verbose** - Show more debugging information. - **--no-ansi** - Show output without ANSI codes. - **--help** - Show help banner of specified command. ``` -------------------------------- ### View the generated project structure Source: https://guides.cocoapods.org/making/using-pod-lib-create Displays the directory structure of the newly created library project after running pod install. ```bash $ tree MyLib -L 2 MyLib ├── .travis.yml ├── _Pods.xcproject ├── Example │ ├── MyLib │ ├── MyLib.xcodeproj │ ├── MyLib.xcworkspace │ ├── Podfile │ ├── Podfile.lock │ ├── Pods │ └── Tests ├── LICENSE ├── MyLib.podspec ├── MyLib │ ├── Assets │ └── Classes │ └── RemoveMe.[swift/m] └── README.md ``` -------------------------------- ### Integrate CocoaPods into a Project Source: https://guides.cocoapods.org/terminal/commands.html Standard workflow for creating a Podfile and installing dependencies. ```bash $ touch Podfile $ vim Podfile $ pod install ``` ```bash $ open *.xcworkspace ``` ```bash $ vim podfile $ pod install ``` ```bash $ pod outdated ``` ```bash $ pod update ``` -------------------------------- ### Define Pre-Install Hook Source: https://guides.cocoapods.org/syntax/podfile.html Allows modifications to Pods after download but before installation. Receives the Pod::Installer object. ```ruby pre_install do |installer| # Do something fancy! end ``` -------------------------------- ### Run CocoaPods tests and examples Source: https://guides.cocoapods.org/contributing/dev-environment.html Execute these commands within a specific gem directory to verify changes. ```bash $ rake spec $ rake examples:build ``` -------------------------------- ### Basic Podspec Example Source: https://guides.cocoapods.org/syntax/podspec.html A simple podspec demonstrating essential attributes like name, version, license, homepage, authors, summary, source, and source files. Use this for straightforward library definitions. ```ruby Pod::Spec.new do |spec| spec.name = 'Reachability' spec.version = '3.1.0' spec.license = { :type => 'BSD' } spec.homepage = 'https://github.com/tonymillion/Reachability' spec.authors = { 'Tony Million' => 'tonymillion@gmail.com' } spec.summary = 'ARC and GCD Compatible Reachability Class for iOS and OS X.' spec.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' } spec.source_files = 'Reachability.{h,m}' spec.framework = 'SystemConfiguration' end ``` -------------------------------- ### Specify pod versions Source: https://guides.cocoapods.org/using/the-podfile.html Examples of defining dependency versions, ranging from latest to specific versions. ```ruby pod 'SSZipArchive' ``` ```ruby pod 'Objection', '0.9' ``` -------------------------------- ### Install Specific Subspecs of a Pod Source: https://guides.cocoapods.org/syntax/podspec.html Installs a pod with only the specified subspecs. The subspecs will inherit dependencies and attributes from the root specification. ```ruby pod 'ShareKit/Twitter', '2.0' pod 'ShareKit/Pinboard', '2.0' ``` -------------------------------- ### Define a Simple Script Phase Source: https://guides.cocoapods.org/syntax/podspec.html Use `spec.script_phase` to define a script that runs during the build process. This example shows a basic 'Hello World' script. ```ruby spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"' } ``` -------------------------------- ### Conditionally run pod install in CI Source: https://guides.cocoapods.org/plugins/optimising-ci-times.html Use this command in your CI pipeline to execute pod install only when the check fails, reducing build times. ```bash bundle exec pod check || bundle exec pod install ``` -------------------------------- ### Use Pod from Local Path Source: https://guides.cocoapods.org/syntax/podfile.html Use this to develop a Pod in tandem with its client project. Edits will persist to CocoaPods installations. ```ruby pod 'AFNetworking', :path => '~/Documents/AFNetworking' ``` -------------------------------- ### Configure Build Configurations Source: https://guides.cocoapods.org/syntax/podfile.html Restricts dependency installation to specific build configurations. ```ruby pod 'PonyDebugger', :configurations => ['Debug', 'Beta'] ``` ```ruby pod 'PonyDebugger', :configuration => 'Debug' ``` -------------------------------- ### Get Pod Information Source: https://guides.cocoapods.org/terminal/commands.html Retrieves information about a specified pod from the trunk. ```bash pod trunk info NAME ``` -------------------------------- ### Install new pods Source: https://guides.cocoapods.org/using/pod-install-vs-update.html Use this command when adding or removing pods from your Podfile to ensure existing dependencies remain locked to their current versions. ```bash pod install ``` -------------------------------- ### Define Podspec Contents Source: https://guides.cocoapods.org/making/private-cocoapods Example configuration for a Podspec file defining metadata, source, and platform requirements. ```ruby Pod::Spec.new do |s| s.name = "Artsy+OSSUIFonts" s.version = "1.1.1" s.summary = "The open source fonts for Artsy apps + UIFont categories." s.homepage = "https://github.com/artsy/Artsy-OSSUIFonts" s.license = 'Code is MIT, then custom font licenses.' s.author = { "Orta" => "orta.therox@gmail.com" } s.source = { :git => "https://github.com/artsy/Artsy-OSSUIFonts.git", :tag => s.version } s.social_media_url = 'https://twitter.com/artsy' s.platform = :ios, '7.0' s.requires_arc = true s.source_files = 'Pod/Classes' s.resources = 'Pod/Assets/*' s.frameworks = 'UIKit', 'CoreText' s.module_name = 'Artsy_UIFonts' end ``` -------------------------------- ### pod ipc repl Source: https://guides.cocoapods.org/terminal/commands.html Starts a REPL that listens to commands on standard input and prints results to standard output. ```APIDOC ## pod ipc repl ### Description The repl listens to commands on standard input and prints their result to standard output. It accepts all the other ipc subcommands. The repl will signal the end of output with the the ASCII CR+LF \n\r. ### Parameters #### Options - **--project-directory** (string) - Optional - The path to the root of the project directory. ``` -------------------------------- ### Reference Plugin in Podfile Source: https://guides.cocoapods.org/plugins/setting-up-plugins.html After adding a plugin to your Gemfile, reference it in your Podfile to activate its functionality. This example shows how to enable the 'cocoapods-repo-update' plugin. ```ruby platform :ios, '9.0' + plugin 'cocoapods-repo-update' use_frameworks! # OWS Pods pod 'SignalCoreKit', git: 'https://github.com/signalapp/SignalCoreKit.git', testspecs: ["Tests"] ``` -------------------------------- ### Try a Pod Source: https://guides.cocoapods.org/terminal/commands.html Downloads a Pod and opens its demo project. Use a Git URL to use the head of the repository. ```bash pod try NAME|URL ``` -------------------------------- ### Initialize Bare Git Repository Source: https://guides.cocoapods.org/making/private-cocoapods Create a bare Git repository on a server to serve as the Spec repository. ```bash $ cd /opt/git $ mkdir Specs.git $ cd Specs.git $ git init --bare ``` -------------------------------- ### Initialize a new CocoaPods library Source: https://guides.cocoapods.org/making/using-pod-lib-create Use this command to bootstrap a new library project. You can optionally provide a custom template URL using the --template-url parameter. ```bash pod lib create MyLibrary ``` -------------------------------- ### Execute logic with post_integrate Source: https://guides.cocoapods.org/syntax/podfile.html Use this hook to perform actions after the project has been written to disk. It receives the Pod::Installer instance as an argument. ```ruby post_integrate do |installer| # some change after project write to disk end ``` -------------------------------- ### pod init Source: https://guides.cocoapods.org/terminal/commands.html Creates a Podfile for the current directory. ```APIDOC ## pod init ### Description Creates a Podfile for the current directory if none currently exists. If an XCODEPROJ project file is specified or if there is only a single project file in the current directory, targets will be automatically generated based on targets defined in the project. ### Parameters #### Path Parameters - **XCODEPROJ** (string) - Optional - The path to the Xcode project file. ### Inherited options - **--allow-root** - Allows CocoaPods to run as root. - **--silent** - Show nothing. - **--version** - Show the version of the tool. - **--verbose** - Show more debugging information. - **--no-ansi** - Show output without ANSI codes. - **--help** - Show help banner of specified command. ``` -------------------------------- ### Register a Trunk account Source: https://guides.cocoapods.org/making/getting-setup-with-trunk Initiates a session on the current device by registering an email address and providing a session description. ```bash $ pod trunk register orta@cocoapods.org 'Orta Therox' --description='macbook air' ``` -------------------------------- ### Register New Account or Session Source: https://guides.cocoapods.org/terminal/commands.html Registers a new account or creates a new session for trunk. Provide email and optionally your name. Use --description to add an identifier for the session. ```bash pod trunk register EMAIL [YOUR_NAME] ``` ```bash $ pod trunk register eloy@example.com `Eloy Durán` --description=`Personal Laptop` ``` ```bash $ pod trunk register eloy@example.com --description=`Work Laptop` ``` ```bash $ pod trunk register eloy@example.com ``` -------------------------------- ### Initialize Podfile Source: https://guides.cocoapods.org/terminal/commands.html Creates a Podfile in the current directory. Targets are automatically generated if an Xcode project is detected. ```bash pod init XCODEPROJ ``` -------------------------------- ### Initialize CocoaPods Source: https://guides.cocoapods.org/terminal/commands.html Basic command to invoke the CocoaPods tool. ```bash pod ``` -------------------------------- ### Remove Private Repository Source: https://guides.cocoapods.org/making/private-cocoapods Remove a registered private repository from the local CocoaPods installation. ```bash pod repo remove [name] ``` -------------------------------- ### Add a Private Spec Repo Source: https://guides.cocoapods.org/making/private-cocoapods Register a new private repository with the local CocoaPods installation. ```bash $ pod repo add REPO_NAME SOURCE_URL ``` ```bash $ pod repo add artsy-specs https://github.com/artsy/Specs.git ``` -------------------------------- ### Configure Podfile for Binary Pre-compilation Source: https://guides.cocoapods.org/plugins/pre-compiling-dependencies.html Add the cocoapods-binary plugin and specify which pods should be pre-compiled by appending the :binary => true option. ```ruby plugin 'cocoapods-binary' use_frameworks! target "HP" do - pod "ExpectoPatronum" + pod "ExpectoPatronum", :binary => true end ``` -------------------------------- ### Define a Podspec with subspecs Source: https://guides.cocoapods.org/making/specs-and-specs-repo.html Use subspecs to allow users to install specific components of a library independently. ```ruby Pod::Spec.new do |spec| spec.name = 'ShareKit' spec.source_files = 'Classes/ShareKit/{Configuration,Core,Customize UI,UI}/**/*.{h,m,c}' # ... spec.subspec 'Evernote' do |evernote| evernote.source_files = 'Classes/ShareKit/Sharers/Services/Evernote/**/*.{h,m}' end spec.subspec 'Facebook' do |facebook| facebook.source_files = 'Classes/ShareKit/Sharers/Services/Facebook/**/*.{h,m}' facebook.compiler_flags = '-Wno-incomplete-implementation -Wno-missing-prototypes' facebook.dependency 'Facebook-iOS-SDK' end # ... end ``` -------------------------------- ### Create a New Pod Library Source: https://guides.cocoapods.org/terminal/commands.html Generates a project scaffold for a new library. Optionally specify a custom template URL to override the default structure. ```bash pod lib create NAME ``` -------------------------------- ### Create Podspec File Source: https://guides.cocoapods.org/making/private-cocoapods Initialize a new podspec file on the local machine. ```bash cd ~/Desktop touch Artsy+OSSUIFonts.podspec ``` -------------------------------- ### Set Multiple Default Subspecs Source: https://guides.cocoapods.org/syntax/podspec.html Sets multiple default subspecs for a pod. Users will get these subspecs by default. ```ruby spec.default_subspecs = 'Core', 'UI' ``` -------------------------------- ### Specify Platform and Deployment Target Source: https://guides.cocoapods.org/syntax/podfile.html Use `platform` to specify the target platform and optionally a deployment target version. Defaults are provided if no version is specified. ```ruby platform :ios, '4.0' ``` ```ruby platform :ios ``` -------------------------------- ### Configure Scheme with Launch Arguments and Environment Variables Source: https://guides.cocoapods.org/syntax/podspec.html Configures the scheme for a specification with both launch arguments and environment variables. This provides more control over the application's runtime environment. ```ruby spec.scheme = { :launch_arguments => ['Arg1', 'Arg2'], :environment_variables => { 'Key1' => 'Val1'} } ``` -------------------------------- ### Add Plugin to Gemfile Source: https://guides.cocoapods.org/plugins/setting-up-plugins.html To install a CocoaPods plugin, add its gem to your project's Gemfile. This makes the plugin available for use with your project. ```ruby source 'https://rubygems.org' gem 'cocoapods' + gem 'cocoapods-repo-update' gem 'fastlane' ``` -------------------------------- ### Define Script Phase with Custom Shell Path Source: https://guides.cocoapods.org/syntax/podspec.html Use `:shell_path` to specify the interpreter for the script. This example uses Ruby to execute the script. ```ruby spec.script_phase = { :name => 'Hello World', :script => 'puts "Hello World"', :shell_path => '/usr/bin/ruby' } ``` -------------------------------- ### Specify Public Header Files Source: https://guides.cocoapods.org/syntax/podspec.html Use `spec.public_header_files` to define which header files are exposed to consumers of the pod. This example targets headers in a 'Headers/Public' directory. ```ruby spec.public_header_files = 'Headers/Public/*.h' ``` -------------------------------- ### Link System Frameworks for Pod Source: https://guides.cocoapods.org/syntax/podspec.html List system frameworks that the target needs to link against. ```ruby spec.ios.framework = 'CFNetwork' ``` ```ruby spec.frameworks = 'QuartzCore', 'CoreData' ``` -------------------------------- ### Use local path for development Source: https://guides.cocoapods.org/using/the-podfile.html Links a pod directly from a local directory for active development. ```ruby pod 'Alamofire', :path => '~/Documents/Alamofire' ``` -------------------------------- ### Define Script Phase with Execution Position Source: https://guides.cocoapods.org/syntax/podspec.html Specify when a script phase should execute using `:execution_position`. `:before_compile` runs the script before the main compilation starts. ```ruby spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"', :execution_position => :before_compile } ``` -------------------------------- ### List local repositories Source: https://guides.cocoapods.org/terminal/commands.html Displays all repositories currently stored in the local spec-repos directory. ```bash pod repo list ``` -------------------------------- ### Prepare and Release Pod to Trunk Source: https://guides.cocoapods.org/making/making-a-cocoapod.html After linting and editing the podspec, commit changes, tag the version, and push to trunk. ```bash $ cd ~/code/Pods/NAME $ edit NAME.podspec # set the new version to 0.0.1 # set the new tag to 0.0.1 $ pod lib lint $ git add -A && git commit -m "Release 0.0.1." $ git tag '0.0.1' $ git push --tags ``` -------------------------------- ### Configure on-demand resources Source: https://guides.cocoapods.org/syntax/podspec.html Defines resources to be copied into the target bundle with specific tags and categories. Defaults to :download_on_demand if no category is provided. ```ruby s.on_demand_resources = { 'Tag1' => 'file1.png' } ``` ```ruby s.on_demand_resources = { 'Tag1' => ['file1.png', 'file2.png'] } ``` ```ruby s.on_demand_resources = { 'Tag1' => { :paths => ['file1.png', 'file2.png'], :category => :download_on_demand } } ``` ```ruby s.on_demand_resources = { 'Tag1' => { :paths => ['file1.png', 'file2.png'], :category => :initial_install } } ``` -------------------------------- ### Configure Static Framework for Pod Source: https://guides.cocoapods.org/syntax/podspec.html When `use_frameworks!` is specified, this attribute indicates that the Pod should include a static library framework. ```ruby spec.static_framework = true ``` -------------------------------- ### Platform and Project Settings Source: https://guides.cocoapods.org/syntax/podfile.html Configures the target platform and links the Podfile to specific Xcode projects. ```APIDOC ## platform ### Description Specifies the platform and optional deployment target for the library. ### Parameters - **nameSymbol** (Symbol) - Required - Platform name: `:osx`, `:ios`, `:tvos`, `:visionos`, or `:watchos`. - **targetString** (String) - Optional - Deployment version. ## project ### Description Specifies the Xcode project to link with the Pods library. ### Parameters - **pathString** (String) - Required - Path of the project. - **build_configurationsHash** (Hash) - Optional - Mapping of build configurations to `:debug` or `:release`. ``` -------------------------------- ### Specify platform and version in Podfile Source: https://guides.cocoapods.org/using/using-cocoapods.html Declare the minimum iOS version your project supports. This line should be at the top of your Podfile. ```ruby platform :ios, '9.0' ``` -------------------------------- ### Define Script Phase with Input/Output File Lists Source: https://guides.cocoapods.org/syntax/podspec.html Use `:input_file_lists` and `:output_file_lists` to reference file lists for script phases. This is useful for managing many files. ```ruby spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"', :input_file_lists => ['/path/to/input_files.xcfilelist'], :output_file_lists => ['/path/to/output_files.xcfilelist'] } ``` -------------------------------- ### Define Post-Install Hook Source: https://guides.cocoapods.org/syntax/podfile.html Allows last-minute changes to the generated Xcode project before it's written to disk, or other post-installation tasks. Receives the Pod::Installer object. ```ruby post_install do |installer| # perform some changes on dependencies end ``` -------------------------------- ### Basic Podfile Structure Source: https://guides.cocoapods.org/syntax/podfile.html A simple Podfile specifying a target and a single dependency. ```ruby target 'MyApp' pod 'AFNetworking', '~> 1.0' ``` -------------------------------- ### Define Script Phase with Input and Output Files Source: https://guides.cocoapods.org/syntax/podspec.html Specify input and output files for a script phase using `:input_files` and `:output_files`. These paths are relative to the podspec. ```ruby spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"', :input_files => ['/path/to/input_file.txt'], :output_files => ['/path/to/output_file.txt'] } ``` -------------------------------- ### Customize build settings with post_install Source: https://guides.cocoapods.org/syntax/podfile.html Use this hook to modify build settings for all targets after the pods project is generated but before it is written to disk. ```ruby post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['GCC_ENABLE_OBJC_GC'] = 'supported' end end end ``` -------------------------------- ### Screenshots Source: https://guides.cocoapods.org/syntax/podspec.html A list of URLs to images showcasing the Pod, recommended in GIF format. ```APIDOC ## screenshots ### Description A list of URLs to images showcasing the Pod. Intended for UI oriented libraries. CocoaPods recommends the usage of the `gif` format. ### Examples: ```ruby spec.screenshot = 'http://dl.dropbox.com/u/378729/MBProgressHUD/1.png' ``` ```ruby spec.screenshots = [ 'http://dl.dropbox.com/u/378729/MBProgressHUD/1.png', 'http://dl.dropbox.com/u/378729/MBProgressHUD/2.png' ] ``` ``` -------------------------------- ### Configure resources Source: https://guides.cocoapods.org/syntax/podspec.html Specifies a list of resources to be copied directly into the client target bundle. ```ruby spec.resource = 'Resources/HockeySDK.bundle' ``` ```ruby spec.resources = ['Images/*.png', 'Sounds/*'] ``` -------------------------------- ### Set Platform for Pod Source: https://guides.cocoapods.org/syntax/podspec.html Specify the platform on which the Pod is supported. Leaving this blank means the Pod is supported on all platforms. Use `deployment_target` for multiple platforms. ```ruby spec.platform = :osx, '10.8' ``` ```ruby spec.platform = :ios ``` ```ruby spec.platform = :osx ``` -------------------------------- ### Set README URL Source: https://guides.cocoapods.org/syntax/podspec.html Use `spec.readme` to provide the URL for the pod's README markdown file. ```ruby spec.readme = 'https://www.example.com/Pod-1.5-README.md' ``` -------------------------------- ### Specify license by type and file Source: https://guides.cocoapods.org/syntax/podspec.html Use `spec.license` with a hash containing `:type` and `:file` to specify the license type and the path to the license file. ```ruby spec.license = { :type => 'MIT', :file => 'MIT-LICENSE.txt' } ``` -------------------------------- ### Define Pre-Integrate Hook Source: https://guides.cocoapods.org/syntax/podfile.html Enables changes to be made before the project is written to disk. Receives the Pod::Installer object. ```ruby pre_integrate do |installer| # perform some changes on dependencies end ``` -------------------------------- ### Use Modular Headers Source: https://guides.cocoapods.org/syntax/podfile.html Use `use_modular_headers!` to enforce modular headers for all static libraries. Individual pods can be configured with `:modular_headers => true` or `:modular_headers => false`. ```ruby use_modular_headers! ``` ```ruby pod 'SSZipArchive', :modular_headers => true ``` ```ruby pod 'SSZipArchive', :modular_headers => false ``` -------------------------------- ### Set multiple screenshot URLs Source: https://guides.cocoapods.org/syntax/podspec.html Use `spec.screenshots` with an array of URLs to list multiple images showcasing the pod. GIF format is recommended. ```ruby spec.screenshots = [ 'http://dl.dropbox.com/u/378729/MBProgressHUD/1.png', 'http://dl.dropbox.com/u/378729/MBProgressHUD/2.png' ] ``` -------------------------------- ### Configure Scheme with Launch Arguments Source: https://guides.cocoapods.org/syntax/podspec.html Configures the scheme for a specification to include specific launch arguments. This is useful for testing or setting up specific application states. ```ruby spec.scheme = { :launch_arguments => ['Arg1'] } ``` -------------------------------- ### Referencing a Pod with a Local Path Source: https://guides.cocoapods.org/making/development-cocoapods.html Use the `:path` option in your Podfile to point to your local checkout of a Pod's repository. This is essential for development Pods. ```ruby pod 'AwesomeView', :path => '/Users/yourusername/path/to/pod/repo/AwesomeView' ``` -------------------------------- ### Set pod summary Source: https://guides.cocoapods.org/syntax/podspec.html Use `spec.summary` to provide a concise, informative description of the pod, limited to 140 characters. ```ruby spec.summary = 'Computes the meaning of life.' ``` -------------------------------- ### Configure resource bundles Source: https://guides.cocoapods.org/syntax/podspec.html Defines resource bundles to be built for the Pod, recommended for static libraries to avoid name collisions. ```ruby spec.ios.resource_bundle = { 'MapBox' => 'MapView/Map/Resources/*.png' } ``` ```ruby spec.resource_bundles = { 'MapBox' => ['MapView/Map/Resources/*.png'], 'MapBoxOtherResources' => ['MapView/Map/OtherResources/*.png'] } ``` -------------------------------- ### Configure vendored libraries Source: https://guides.cocoapods.org/syntax/podspec.html Specifies precompiled libraries to include in the Pod. Use platform-specific or general attributes to define paths. ```ruby spec.ios.vendored_library = 'Libraries/libProj4.a' ``` ```ruby spec.vendored_libraries = 'libProj4.a', 'libJavaScriptCore.a' ``` -------------------------------- ### Clone the CocoaPods repository Source: https://guides.cocoapods.org/using/unreleased-features.html Initial step to download the CocoaPods source code to a local directory. ```bash cd projects/cocoapods/ git clone https://github.com/CocoaPods/CocoaPods.git ``` -------------------------------- ### Resources Configuration Source: https://guides.cocoapods.org/syntax/podspec.html Specifies a list of resources to be copied into the target bundle. Recommended to use resource bundles for static libraries to avoid name collisions and Xcode optimization issues. ```APIDOC ## resources ### Description A list of resources that should be copied into the target bundle. For building the Pod as a static library, we strongly **recommend** library developers to adopt resource bundles as there can be name collisions using the resources attribute. Moreover, resources specified with this attribute are copied directly to the client target and therefore they are not optimised by Xcode. ### Examples: ```ruby spec.resource = 'Resources/HockeySDK.bundle' ``` ```ruby spec.resources = ['Images/*.png', 'Sounds/*'] ``` ``` -------------------------------- ### Define a complex Podfile with test targets Source: https://guides.cocoapods.org/using/the-podfile.html Configures multiple sources, platform requirements, and nested test targets with inherited search paths. ```ruby source 'https://cdn.cocoapods.org/' source 'https://github.com/Artsy/Specs.git' platform :ios, '9.0' inhibit_all_warnings! target 'MyApp' do pod 'GoogleAnalytics', '~> 3.1' # Has its own copy of OCMock # and has access to GoogleAnalytics via the app # that hosts the test target target 'MyAppTests' do inherit! :search_paths pod 'OCMock', '~> 2.0.1' end end post_install do |installer| installer.pods_project.targets.each do |target| puts target.name end end ``` -------------------------------- ### Specify Git source with tag Source: https://guides.cocoapods.org/syntax/podspec.html Use `spec.source` with a Git repository URL and a specific tag for version control. ```ruby spec.source = { :git => 'https://github.com/AFNetworking/AFNetworking.git', :tag => spec.version.to_s } ``` -------------------------------- ### Lint Pod Locally Source: https://guides.cocoapods.org/making/making-a-cocoapod.html Run 'pod lib lint' in your pod's directory to check the syntax of your podspec file before releasing. ```bash $ cd ~/code/Pods/NAME $ pod lib lint ``` -------------------------------- ### Specify Multiple System Libraries Source: https://guides.cocoapods.org/syntax/podspec.html Use `spec.libraries` to specify multiple system libraries that the application needs to link against. ```ruby spec.libraries = 'xml2', 'z' ``` -------------------------------- ### Standard Pod Reference Source: https://guides.cocoapods.org/making/development-cocoapods.html This is the typical way to reference a Pod in a Podfile when not using it as a development Pod. ```ruby pod 'AwesomeView', '~> 1.42.0' ``` -------------------------------- ### Specify license by type and text Source: https://guides.cocoapods.org/syntax/podspec.html Use `spec.license` with a hash containing `:type` and `:text` to specify the license type and the full text of the license notice. ```ruby spec.license = { :type => 'MIT', :text => <<-LICENSE Copyright 2012 Permission is granted to... LICENSE } ``` -------------------------------- ### Add a CDN spec repository Source: https://guides.cocoapods.org/terminal/commands.html Registers a CDN-based URL as a local spec repository. ```bash pod repo add-cdn NAME URL ``` -------------------------------- ### Create a PodSpec Source: https://guides.cocoapods.org/terminal/commands.html Generates a new Podspec file in the current directory. Providing a GitHub URL will prepopulate the file. ```bash pod spec create [NAME|https://github.com/USER/REPO] ``` -------------------------------- ### Add a single pod to a target in Podfile Source: https://guides.cocoapods.org/using/using-cocoapods.html Include a specific library within your application's target block in the Podfile. Replace '$PODNAME' with the actual pod name. ```ruby target 'MyApp' do pod 'ObjectiveSugar' end ``` -------------------------------- ### Summary Source: https://guides.cocoapods.org/syntax/podspec.html A short, informative description of the Pod (max 140 characters). ```APIDOC ## summary ### Description A short (maximum 140 characters) description of the Pod. The description should be short, yet informative. It represents the tag line of the Pod and there is no need to specify that a Pod is a library (they always are). The summary is expected to be properly capitalised and containing the correct punctuation. ### Examples: ```ruby spec.summary = 'Computes the meaning of life.' ``` ``` -------------------------------- ### Global Configuration Attributes Source: https://guides.cocoapods.org/syntax/podfile.html Global settings for warning inhibition and modular headers. ```APIDOC ## inhibit_all_warnings! ### Description Inhibits all warnings from CocoaPods libraries. Inherited by child targets. ## use_modular_headers! ### Description Enables modular headers for all CocoaPods static libraries. Inherited by child targets. ``` -------------------------------- ### Specify license by type Source: https://guides.cocoapods.org/syntax/podspec.html Use `spec.license` with a string to specify the license type, such as 'MIT'. ```ruby spec.license = 'MIT' ``` -------------------------------- ### Define a basic Podfile target Source: https://guides.cocoapods.org/using/the-podfile.html A simple configuration to add a dependency to a single Xcode target. ```ruby target 'MyApp' do use_frameworks! pod 'Alamofire', '~> 3.0' end ``` -------------------------------- ### Set Deployment Target for macOS Source: https://guides.cocoapods.org/syntax/podspec.html Define the minimum deployment target version for macOS. ```ruby spec.osx.deployment_target = '10.8' ``` -------------------------------- ### Execute local pod command Source: https://guides.cocoapods.org/contributing/dev-environment.html Run the pod command directly from the local repository path. ```bash path/to/CocoaPods/CocoaPods/bin/pod install ```