You might have read our recent blog on SDUI framework that introduced the concept of UI presentation made easier by eliminating the need for frequent updates to an application by the end user. It is built and deployed with just “one code base logic” and is applicable for each of the UI releases while eliminating the need for frequent updates of the Apps.

The framework can be of used in other iOS projects; hence it requires a lot of effort in manually installing and building it. Therefore, to overcome this challenge the team explored various options and found a more centralized solution, ‘CocoaPods’ - a dependency manager tool that provides a standard format for managing the external libraries. It has over 27 thousand libraries and is used in over 1.6 million apps and can help scale any project elegantly. It focuses on the source-based distribution of third party code and automatic integration into Xcode projects.

Getting Started

The dependencies for projects are specified in a single text file called a Podfile. CocoaPods will resolve the dependencies between libraries, fetch the resulting source code, and then link it together in the XCode workspace to build your project.

Follow the Below Steps to Add Private Pod in Your Ios Project:

By default, CocoaPods uses a public specification repository (https://github.com/CocoaPods/Specs). If you want to make your pod private then you have to create a private repository with the same structure and upload your pod specification file to the private repository.

Installation

1. CocoaPods is built with Ruby and it will be installable with the default Ruby available on Mac OS. Using the default Ruby install will require you to use “sudo” when installing gems.

The specification file contains detailed information about the repository. When you execute pod install or pod update commands, CocoaPods will look into the specification file and clone the repository.

Follow the Below Steps:

1.Create a specification for your pod using the following command:

$podspec create <your_pod_name>

Example: pod spec create AppUtils

2.Edit the AppUtils.podspec

Name – name of the pod.

Version – the current version for the specification. Your repo must contain a tag for the version number. i.e. 1.0,1.2 etc.

Summary – a short summary of project.

Description – detailed description of the project.

Homepage – homepage of the project.

License – license for the project, i.e – MIT,BSD.

Author – author of the repo.

Platform – OS and version used in the repo, i.e. iOS 9.0.

Source – source URL of the repo.

source_files – files to be included in the pod.

exclude_files – files not to be included in the pod.

Dependency – any third party dependency for the pod project.

3.Now verify the pod spec file by using the following command:

$ pod spec lint AppUtils.podspec

Solve any error or warning that may occur while validating .podspec file

4.Now upload the specification file to your specification repository.

CocoaPod is using a public specification repository for the public pod. If you want to create a private pod then you have to create your own private specification repo that will store.podspec files.

Each version has its own specification file. Your specification repository can have more than one specification.

5.Specifying a private pod in Podfile.

If you are using a private pod then you have to tell CocoaPod, where the specification repository is located by specifying the source at top of the Podfile: