{"id":122,"date":"2018-08-17T09:51:43","date_gmt":"2018-08-17T09:51:43","guid":{"rendered":"http:\/\/139.59.4.234\/blog-test\/?p=122"},"modified":"2019-01-12T12:16:45","modified_gmt":"2019-01-12T12:16:45","slug":"working-with-cocoapods-in-ios-swift","status":"publish","type":"post","link":"https:\/\/citrusleaf.in\/blog\/working-with-cocoapods-in-ios-swift\/","title":{"rendered":"Working with CocoaPods in iOS\/Swift"},"content":{"rendered":"<p>CocoaPods manages library dependencies for your Xcode projects. <a href=\"https:\/\/cocoapods.org\/\">https:\/\/cocoapods.org\/<\/a> It&#8217;s one of the largest dependencies providers to millions of iOS developers worldwide.<\/p>\n<p><strong>Installation<\/strong><\/p>\n<p>There are 2 ways to install CocoaPods :<\/p>\n<ul>\n<li>Mac App: download from <a href=\"https:\/\/cocoapods.org\/app\">https:\/\/cocoapods.org\/app<\/a> mac app and start it<\/li>\n<li>Manually: Manual installation is well documented and simple enough to use. <a href=\"https:\/\/guides.cocoapods.org\/using\/getting-started.html#getting-started\">https:\/\/guides.cocoapods.org\/using\/getting-started.html#getting-started<\/a><\/li>\n<\/ul>\n<p>However, there are certain more steps that you need to perform to get it working. This post will help you in understandig those steps.<\/p>\n<p><strong>Steps:<\/strong><\/p>\n<ul>\n<li>Open a terminal<\/li>\n<li>navigate to project folder(containing projectname.xcodeproj).<\/li>\n<li>enter command pod init<\/li>\n<li>this will create a Podfile in your project folder.<\/li>\n<li>do not open the Podfile in the terminal.<\/li>\n<li>open Podfile in the Xcode using command open -a Xcode Podfile.<\/li>\n<li>go to <a href=\"https:\/\/cocoapods.org\/\">https:\/\/cocoapods.org\/<\/a>.<\/li>\n<li>Search for the dependency e.g Alamofire.<\/li>\n<li>Expand Alamofire<\/li>\n<li>Click on the button &#8220;Installation Guide&#8221; located on right side(Scroll down a bit).<\/li>\n<li>Copy and paste pod &#8216;Alamofire&#8217;, &#8216;~&gt; 4.5&#8217; into your Podfile<\/li>\n<li>target &#8216;MyApp&#8217; do<\/li>\n<li>pod &#8216;Alamofire&#8217;, &#8216;~&gt; 4.5&#8217;<\/li>\n<li>end<\/li>\n<li>save it.<\/li>\n<li>go back to your terminal.<\/li>\n<li>type command pod install and press enter.<\/li>\n<li>It will add the dependency.<\/li>\n<li>Now open finder go to your project folder and open ProjectName.xcworkspace<\/li>\n<li>Don&#8217;t open the project from Xcode it will by default open .xcodeproj.<\/li>\n<li>And you won&#8217;t be able to resolve the module you imported in that.<\/li>\n<li>After you open the project.<\/li>\n<li>Before importing the module build the project.<\/li>\n<li>after the build succeeds feel free to use it.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>CocoaPods manages library dependencies for your Xcode projects. https:\/\/cocoapods.org\/ It&#8217;s one of the largest dependencies providers to millions of iOS developers worldwide. Installation There are 2 ways to install CocoaPods : Mac App: download from&hellip; <\/p>\n","protected":false},"author":2,"featured_media":123,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[10],"tags":[],"class_list":["post-122","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/citrusleaf.in\/blog\/wp-content\/uploads\/2018\/10\/featured_image-4.png?fit=1024%2C600&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pei5Vv-1Y","_links":{"self":[{"href":"https:\/\/citrusleaf.in\/blog\/wp-json\/wp\/v2\/posts\/122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/citrusleaf.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/citrusleaf.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/citrusleaf.in\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/citrusleaf.in\/blog\/wp-json\/wp\/v2\/comments?post=122"}],"version-history":[{"count":1,"href":"https:\/\/citrusleaf.in\/blog\/wp-json\/wp\/v2\/posts\/122\/revisions"}],"predecessor-version":[{"id":124,"href":"https:\/\/citrusleaf.in\/blog\/wp-json\/wp\/v2\/posts\/122\/revisions\/124"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/citrusleaf.in\/blog\/wp-json\/wp\/v2\/media\/123"}],"wp:attachment":[{"href":"https:\/\/citrusleaf.in\/blog\/wp-json\/wp\/v2\/media?parent=122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/citrusleaf.in\/blog\/wp-json\/wp\/v2\/categories?post=122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/citrusleaf.in\/blog\/wp-json\/wp\/v2\/tags?post=122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}