Telerik blogs
The introduction of the AppStore revolutionized the way we buy applications. In a similar way package managers have changed the way developers use libraries. During the past years, every major language and platform obtained its own package manager-- RubyGems for ruby, npm for node.js, bower for JS, CSS and HTML. Package managers help developers easily share and consume software libraries, and manage versions and dependencies. If you have the option to choose between manually downloading and installing the bits from a browser on one hand, and getting them through a package manager on the other, choose the latter. It will save you a lot of time and effort. 

CocoaPods is the package manager used with Xcode. It works equally well for both Objective-C and Swift. We are asked often whether Telerik UI for iOS supports CocoaPods. Currently, we do not ship Telerik UI as a pod (although we have such plans), but it is easy to include it in a private pod. In this post, I’ll show you how to make your own pod containing Telerik UI for iOS (or any other third-party framework). This will allow team members in your organization to include the framework in their projects with a single line of code.
First, install CocoaPods. This is done by using another package manager. 
gem install cocapods
Next, create a podspec that defines the pod. I will not go into details for this step here;there is a good tutorial available on the CocoaPods site. Here is an example of a podspec file: do |s|             = 'repo'
  s.version         = '0.0.1'
  s.license         =  { :type => 'BSD' }
  s.homepage         = ''
  s.authors         = { 'John Smith' => '' }
  s.summary         = 'A cocoa pod containing the TelerikUI framework.'
  s.source           = { :http => '' }
Among the obvious things like name, version, license and so on, there is a source field. It defines where to get the actual pod content from. It can be a git repository, an http server thatreturns a zip file or a local folder on your computer. In this case, I am hosting the pod content locally with the help of the SimpleHTTPServer.
The next step is to add a reference to our Telerik UI for iOS framework. There are two ways to do this, but whichever approach you decide to follow, you will need to get the framework using our Telerik UI for iOS installer.
  • After you obtain the framework using the installer, you can include only a reference to that framework in your pod: 
    s.frameworks = 'TelerikUI'
    s.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '/Applications/' }
    The frameworks variable here specifies the framework name, and the second line points to the folder where this framework can be found. The Frameworks path is where our default installer places a copy of the TelerikUI.framework.
  • You can add the framework in your pod. This way, everything will be contained in a single package. Your project will be ready to use with a single pod install command. To do this you should use the vendored_frameworks field: 
    s.vendored_frameworks = 'TelerikUI.framework'
At this point, we can add any other source files that should be part of the pod:
s.source_files = 'Classes/*.{h,m}'
The podspec file is now ready and you can package it in a zip file with the following structure:


Using the newly created pod is easy. Just follow the steps below:
  1. Create a new project in Xcode.
  2. Open the Terminal, navigate to your project's folder and execute the following command to prepare the project for using CocoaPods:
    pod init
  3. The previous step creates a file named Podfile in your project’s root folder. Add the following line in this file to specify where to get the pod:
    pod 'repo', :http => ''
  4. Execute the following command in the Terminal in order to download and install the pod:
    pod install
That's all. Now the project is ready for use. You can find a sample project and pod files in our public git repo:
Download UI for iOS by Telerik

Tsvetan Raikov image
About the Author

Tsvetan Raikov

Tsvetan is the Team Leader of the UI for iOS team. He has been part of Telerik since 2006, when he joined the company as regular developer in the WinForms team. Tsvetan made his way through all developer postions over the past few years. His addiction to the cutting edge technologies, together with the passion to develop outstanding products are what drive him forward. In his spare time Tsvetan loves biking, hiking and snowboarding. You can find Tsvetan on Twitter @tzraikov, and LinkedIn.


Comments are disabled in preview mode.