How to use CocoaPods with Swift project

If you already know how to install and use CocoaPods then continue else please first visit my previous blog “How to install CocoaPods in XCode” (for Objective-C).


Using CocoaPods or any Objective C library in Swift is not a big deal. XCode is quite smart and it automatically do this for you. You can also check Apple’s documentation on this Using Swift with Cocoa and Objective-C. Once libraries are added, you only need to use a bridging header between Objective-C and Swift and use the new coding style of Swift for calling those methods. Like [MBProgressHUD show] become ) etc. Here I am using the example of MBProgressHUD because it is normally used in most of the projects.


Let’s see how it works:


1. Create a new XCode project and select the language Swift (no need to to this if you already have Swift project).


2. Create a Bridging-Header.h file starting with your project name. like, if my project name is SampleProject, bridging header become: SampleProject-Bridging-Header.h and Put this header at the root directory of your project.


If you are not very sure how to do this, the most simplest way is to add a test objective-c file in your project (remove that later). Xcode will prompt an option to configure bridging. When you press Yes, XCode automatically create the bridging file and put inside root of project directory.



Added Bridging Header:



3. Setup Pod with your project.


4. Add your Pod libraries inside bridging header file as you were normally using in Objective C project.


5.  Now you can access MBProgressHUD methods in your swift like:

         MBProgressHUD.showHUDAddedTo(self.view, animated: true)           
         MBProgressHUD.hideAllHUDsForView(self.view, animated:true)



You can download my SampleProject from git. While reading this if you notice that step5 is missing, then cheers!! you follow this carefully and you understand how it works.


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




Triffort Technologies Pvt Ltd



Posted in iOS, iPhone | iPad, Technology | Tagged CocoaPods, development, iphone, objective-c, pods, swift, xcode


bcgvyW jpbcgaibnyhq, [url=]lckmclkoguvs[/url], [link=]ngmxnjugsuin[/link],

bcgvyW jpbcgaibnyhq, [url=]lckmclkoguvs[/url], [link=]ngmxnjugsuin[/link],

bcgvyW jpbcgaibnyhq, [url=]lckmclkoguvs[/url], [link=]ngmxnjugsuin[/link], - canadian pharmacy meds viagra prices canada drug pharmacy - pharmacy online cheapest generic viagra walmart pharmacy online - canadian pharmacy king buy viagra soft cialis online pharmacy - fast cash personal loan american cash loans paycheck loan - cheap viagra pills canada pharmacy onlineas\kei1.txt,1,N - fast online loans online pharmacy canada - canadian pharmacy review buy viagra without prescription walmart online pharmacy - canadian pharmacy meds buy viagra pills modafinil online pharmacy - online canadian pharmacy buy viagra online ordering drugs from canada - canada drugs online buy cheap viagra canadian pharmacies - canadian online pharmacy 100mg viagra canada drugs direct - canadian online pharmacy buy generic viagra cialis online pharmacy - canadian pharmacy viagra buy cheap cialis canadian pharmacy king - online prescription for viagra how viagra works viagra online cheap - prescription drugs online pharmacy viagra canadian pharmacy online - cheap viagra online natural viagra alternatives best place to buy viagra online forum - generic viagra online canada no prescription cialis 10mg buy generic viagra online - reputable canadian pharmacy generic viagra cheap canadian pharmacy viagra - cheap viagra from canada online cialis soft cheap viagra site - buy viagra and cialis online viagra in canada buy 100mg viagra online - buy cialis online forum tadalafil dosage cialis online australia paypal - best online pharmacy for viagra viagra for sale cheap viagra online - buy generic cialis online viagra pharmacy buy cialis pro - best price generic viagra online generic viagra 100mg generic viagra costco - generic cialis 5mg daily non prescription cialis generic cialis 2018 - cheap viagra online order cialis online viagra samples online - cheap cialis fast cheap cialis buy cialis generic online cheap

JU5wVV xxertiwryojb, [url=]hbwvlmqnmect[/url], [link=]fcpkwgmebxfb[/link], - viagra 100mg generic generic tadalafil online generic viagra - viagra cheap pills effects of viagra where can i get cheap viagra - buying generic cialis online free viagra without prescription buy viagra and cialis online - ?ยป?cialis online tadalafil reviews buy cialis online in usa - when will viagra be generic cialis tadalafil when will viagra go generic - where to buy viagra online forum generic viagra online where buy viagra online - buy cheap viagra online canadian pharmacy viagra online cheap viagra from india - buy viagra online paypal viagra pills buy cheap generic viagra online - buy viagra online lowest viagra price buy viagra usa - can i buy viagra over the counter cialis without prescription where can i buy viagra with paypal

Leave a reply

Your email address will not be published. Required fields are marked *




Social Comments
Go top