How to create your own CocoaPods framework

Hello Everyone,

I hope you are well aware with CocoaPods and how to use this inside your XCode projects. If you are not well aware, follow my previous blog about how to use CocoaPods.

Now it is time to learn to build your own Pod framework.

Setup – What you need?

  • git account.
  • Make sure git is installed in your Mac machine. Because we will do all git commands from terminal only. (using source tree or any other application for git commands is not recommended)
  • Make sure your system is updated and you have latest Ruby Gems installed.
    $ sudo gem update --system
  • Install CocoaPods if you don’t have Pods installed in your Mac machine.
    $ sudo gem install cocoapods

Create your Pod framework

  1. Open terminal and redirect to desired folder where you want to put your Pod Framework.
  2. Create your framework with the command pod lib create. Here I am giving my Pod framework name ‘MZFacebookManager’.
  • $ pod lib create MZFacebookManager
This will ask you some series of questions. You can answer based on your choice. Like for my case I have given answers like this:
  1. What language do you want to use? [ ObjC / Swift ]
     - ObjC
  2. Would you like to include a demo application with your library? [ Yes / No ]
     - Yes
  3. Which testing frameworks will you use? [ Specta / Kiwi / None ]
     - None
  4. Would you like to do view based testing? [ Yes / No ]
     - No
  5. What is your class prefix?
     - MZ

Once you are done it will create the folder for MZFacebookManager. Inside this you can see structure like:

Screen Shot 2017-04-06 at 1.19.25 PM

.podspec file at the root is important file. This will contains your Pod version, dependencies, git url etc with some other Pod descriptions. You can edit the details, version and also define dependencies if your Framework is using any other third party Framework. Like in my case, my Framework is using ‘FBSDKLoginKit‘ and ‘FBSDKCoreKit‘.

Screen Shot 2017-04-06 at 1.20.49 PM

Once you are done with editing of podspec file you need to validate this file. You can do this with Pod lib lint command.

$ pod lib lint

Screen Shot 2017-04-06 at 1.36.27 PM
Now open github website and create a new repository for MZFacebookManager (give your Framework name).

Screen Shot 2017-04-06 at 1.45.58 PMOnce it is created, go back to terminal again and push your code (You can also ignore this Push if you don’t want to push a default code on your git).

But if you want to push, just make sure once again your .podspec file is defined the correct url of git repository.

s.source = { :git => 'https://github.com/muzammil-triffort/MZFacebookManager.git', :tag => s.version.to_s }

Push your code on git: 

$ git push

This will push the default code of your Framework. Now open XCode again and add your Framework files.

  • Delete ReplaceMe file
  • Add your ObjC or Swift files (based on the project type you have chosen at the start)
  • Like i have added three files inside development i.e. MZFacebookManager.h, MZFacebookLoginManager.h and .m files. These files will show when you install the Pod Framework.

Screen Shot 2017-04-06 at 2.00.39 PM

Once all files added and there is no error in your code. Update the version of your Framework by updating this inside .podspec file (0.1.1) and run lib lint command again to make sure everything is correct.

$ pod lib lint

When validation success, now first push the code on git by giving a tag.

$ git tag 0.1.1

$ git push origin 0.1.1

Push your Pods Spec

$ pod trunk push MZFacebookManager.podspec 
At first time you will get the error message to resgister your session:
[!] You need to register a session first. 
$pod trunk register muzammil@triffort.com 'Muzammil' --description='Testing'

Replace my email id and name with yours. This will send a verification link on your mail. Once you verified, you can continue with terminal.

$ pod trunk push MZFacebookManager.podspec 
If all goes well Pod spec successfully update on git and you can see it is showing the description and other Pod details on home page of your git repository.
You can also add –verbose in lib lint and trunk push command to see the detail result (in case of error).
If you open your github repository, you can see screen like this:
Screen Shot 2017-04-06 at 2.22.10 PM
 Summary
# Create Library
pod lib create LibraryName
# Verify podspec
pod lib lint
# Push the podspec
pod trunk push LibraryName.podspec

Yeah! You are done with your first Pod Framework. It’s time to have some nice coffee. 

Still facing any issue with Pod? Or want to be in touch with us? Contact us:

Email:  muzammil@triffort.com Skype: muz.iphonedev

Triffort_logo

Triffort Technologies Pvt Ltd
www.triffort.com

How to hire a great iPhone Developer ?

As the mobile market is overtaking the desktop market, the demand of highly experienced iPhone developers are increasing every day for iPhone app development and iOS programming. Every client want to hire a great iPhone developer for his job but don’t know who is most suitable candidate.

How To Start ?

When you’ve finally figured out what kind of app you’re building, you can start crafting the job requirements to begin your hunt. Write a detail document of your requirement. It would be better to add few screen shot or sketch drawings so developer can easily understand what exactly you needed. Better to have a designer with you or hire any designer also if you want to build something awesome. A developer can’t do all graphics work with excellence.

Developer must have idea about Photoshop and similar image editing software. So he can extract designer’s PSD files or create images from your design. This is not compulsory but better to have. It’s also important to note that not all apps are created equally either, even when you’re hiring someone with specific experience in iPhone app development. It all boils down to the type of app you want to produce.

Who is suitable for you ?

If you’re looking for someone who’s got more than a few apps under his or her belt, make sure Objective C is on the list and that he can do object-oriented programming. That basically means, He organized his code in a way that makes it easier for subsequent developers to pick it up and figure out what’s going on. Passion on the development team will make project managing your iPhone app all that much easier.

If your application is a game, you may not need a developer who works on apps exclusively. You can find a more game-focused developer who can code a game application in a frameworks like Cocos-2d, Unity 3D and OpenGL etc. Usability for games is unique and someone without that gaming background may not have as much to offer in this case. Games are also coded in Objective C, but you’ll have more of a pool of developers to pick from if you look beyond those who’ve just created mobile applications.

If you’re making a native app (an app built with Objective C), you’ll benefit from someone who’s been through the process a few times. A developer with some familiarity coding for an iPhone will have experience working around usability issues and have insights on what can arise when going through the approval process with Apple’s iPhone App store.

 

 

 

 

 

 

A good iPhone developer have a number of tips and tricks regarding submissions to the App Store, and this will save you time in the end. Every time a submission is rejected by Apple, you will have to go through the entire waiting process again. Each time that can be as much as 7-10 business days or more. So, developer should have experience in app submission also. This way, at least he knows what is going on on App Store.

 

 

 

 

What type of experience have you had hiring an iPhone app developer? Please share your stories below.

Author’s name : Muzammil Mohammad

Email : muzammil@triffort.com

Skype : muz.iphonedev