On this line, you can also specify what version of pod you’d like to use. In this case, you’re just adding Alamofire. You can specify different dependencies for every target in your project, for example, a macOS app. You added your app’s name as the target.We’ll use Dynamic Frameworks in this tutorial. From Xcode 9, Swift 4, and CocoaPods 1.5.0, you can use Static Libraries for Swift as well. You told CocoaPods to integrate your dependencies as Dynamic Frameworks instead of Static Libraries.You specified that your app is an iOS app that works on iOS 9 or later.This allows you to add an external repository, like a private one. You specified the specs source repository.You have successfully integrated your dependency! Now open the Terminal App on your Mac and type pod install Then, to integrate a dependency using CocoaPods, you have to create a Podfile in your project root folder, like the following one: # 1 How To Use Itįirst, you need to install it on your Mac, open Terminal and type sudo gem install cocoapods CocoaPods command line tool only works on a Mac. Search feature on CocoaPods website Supported PlatformsĪll Apple platforms, iOS, tvOS, watchOS, and macOS. In order to make it available to others, package developers have to push new versions to this repository by using the pod command line.ĬocoaPods has a wonderful public search feature available on its official website so you don't have to scan the web to find the right dependencies. What does centralized mean? Well, CocoaPods is based on a main repository called Specs that hosts all the framework specifications. It is open-source and was built with Ruby by many volunteers and the open-source community. CocoaPodsĬocoaPods is a centralized dependency manager for Swift and Objective-C Cocoa projects. With a package manager, you can easily manage dependencies inside your software, like Alamofire to help you better handle the network requests inside your to do app. You just want to use a robust, reliable, well crafted, and well-tested framework. Great question! A package manager is a tool that automates the process of installing, upgrading, configuring, and removing a software, or in this case, inside our app.īut what does that really mean? Let's suppose you need to handle network requests inside your app, but you don't want to reinvent the wheel. That doesn’t sound like fun, does it? Well, you’re in luck! By using a package manager, you can easily make sure that your code is always up to date. You might be asking yourself, “Can’t I just copy the source code inside my app project and use that?” Yes, you can, but what will you do if a critical update comes up? You will need to manually follow the repository release updates and keep checking for new versions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |