CocoaPods Repository
Cloudsmith provides public & private repositories for CocoaPods (Swift & Objective-C)
CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects.
For more information on Cocoapods, please see:
- Cocoapods.org: Official Cocoapods public repository and documentation
In the following examples:
Identifier | Description |
---|---|
OWNER | Your Cloudsmith account name or organization name (namespace) |
REPOSITORY | Your Cloudsmith Repository name (also called "slug") |
TOKEN | Your Cloudsmith Entitlement Token (see Entitlements for more details) |
USERNAME | Your Cloudsmith username |
PASSWORD | Your Cloudsmith password |
API-KEY | Your Cloudsmith API Key |
PACKAGE_NAME | The name of your package |
PACKAGE_VERSION | The version number of your package |
Upload a Package
Upload via the Cloudsmith CLI
For full details of how to install and setup the Cloudsmith CLI, see Command-Line Interface
The command to upload an (Objective-C or Swift) CocoaPods package via the Cloudsmith CLI is:
cloudsmith push cocoapods OWNER/REPOSITORY PACKAGE_NAME.tar.gz
Example:
cloudsmith push cocoapods org/repo your-package.tar.gz
Upload via Cloudsmith Website
Please see Upload a Package for details of how to upload via the Website UI.
Download / Install a Package
Setup
Before you can install packages from your Cloudsmith repository you'll need to add your repository to your project's Podfile. This can be done using the source
keyword in your project's Podfile. The source
keyword is a URL to a git repository with the metadata index of all of your repository's private pods.
To add the repository to your project's Podfile, add the following:
Public Repositories
source 'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cocoapods/index.git'
Private Repositories
Private Cloudsmith repositories require authentication. You can choose between two types of authentication, Entitlement Token Authentication or HTTP Basic Authentication.
The setup method will differ depending on what authentication type you choose to use.
Entitlement Tokens, User Credentials and API-Keys should be treated as secrets and you should ensure that you do not commit them in configurations files along with source code, or expose them in any logs
When using HTTP basic authentication, you'll need to configure Git with the proper credentials. Git's standard authentication mechanisms are used by CocoaPods and can be configured in the normal way. For example, you could use git's per-user credential store like so:
git config --global credential.helper store
echo "https://USERNAME:[email protected]" > ~/.git-credentials
source 'https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/cocoapods/index.git'
source 'https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/cocoapods/index.git'
source 'https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/cocoapods/index.git'
source 'https://token:[email protected]/basic/OWNER/REPOSITORY/cocoapods/index.git'
Specifying Dependencies
Add the latest version of a package to your Podfile using the syntax outlined by CocoaPods:
Public Repositories
source 'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cocoapods/index.git'
target 'MyApp' do
pod 'PACKAGE_NAME', '~> PACKAGE_VERSION'
end
Private Repositories
source 'https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/cocoapods/index.git'
target 'MyApp' do
pod 'PACKAGE_NAME', '~> PACKAGE_VERSION'
end
source 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cocoapods/index.git'
target 'MyApp' do
pod 'PACKAGE_NAME', '~> PACKAGE_VERSION'
end
Installing a Package
Once added, the cocoapods tool will download the dependency to the Pods directory in your project, and update the Podfile.lock
after running following command:
pod install
When a dependency is added to the Podfile and retrieved via
pod install
, it gets the new dependency, along with any of its transitive dependencies. However, the cocoapods tool won’t change the versions of any already-acquired dependencies unless that’s necessary to get the new dependency.The cocoapods tool also stores a cache of the index on your machine, so in order to receive the most up to date version of the index it may be necessary to use the
--repo-update
flag to force a repository update before installing your project's pods.
Configuration Example
Here is a complete (but minimal) Podfile
using entitlement token authentication:
source 'https://dl.cloudsmith.io/abcedef1234567/org/repo/cocoapods/index.git'
workspace 'cocoapods-install-example.xcworkspace'
target 'cocoapods-install-example' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for cocoapods-install-example
pod 'cloudsmith-cocoapods-example', '~> 1.0.158207047536418'
end
Upstream Proxying / Caching
Not Supported
Key Signing Support
Not Supported by Format
Troubleshooting
Please see the Troubleshooting page for further help and information.
Updated 4 months ago