Using Cocoapods in Swift

Source: Internet
Author: User
Tags install cocoapods

Reference text: http://www.cocoachina.com/swift/20150630/12305.html

1, first you need to install Cocoapods. Fortunately, Cocoapods is built on Ruby, and the latest version of Mac OS X comes with Ruby. This has been done since OS X 10.7.

Open the terminal and enter the following command line:

sudo gem install Cocoapods

Enter the following command line at the terminal to complete the setup:

Pod Setup--verbose2, turn off the program,Open the terminal and use the CD command to enter the directory containing your Icecreamshop project:CD (drag folder)3. Create a Podfile for your project:pod init4.to edit podfile using Xcode:Open-a Xcode PodfileNote:You cannot use TextEdit to edit podfile, as it is possible to replace standard quotes with a more attractive graphical typeset quotes, which may cause cocoapods to fail to understand and throw an error, So it's best to use Xcode or another programming text editor to edit your podfile. 5. The default podfile looks like this: # Uncomment this line to define a global platform for your project # platform :ios, ‘6.0‘  target  ‘IceCreamShop‘ do end  target  ‘IceCreamShopTests‘ do endReplace the contents of the comment with the following two lines: platform :ios,  "8.0" use_frameworks!This tells cocoapods--that your project is using iOS 8.0 and that the framework will be used instead of the static library. To download the HUD library: pod  ‘MBProgressHUD‘ ‘~> 0.9.0‘To get:

Platform:ios, "8.0"

use_frameworks!

Target ' Myswift ' do

Pod ' Mbprogresshud ', ' ~> 0.9.0 '

End

Target ' myswifttests ' do

End

6. Download the library file (very slow for the first time)

Pod Install

7. Open Project with workspace file

Using Cocoapods in Swift

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.