Installation and Use of Carthage, and installation and use of Carthage

Source: Internet
Author: User

Installation and Use of Carthage, and installation and use of Carthage

Compared with Cocoapods, Cocoapods has its own advantages and disadvantages. For more information, see:

Carthage: four advantages and four disadvantages

 

Step 1: Install Homebrew first

Open the command terminal and enter the following command and press Enter.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

In this way, it will be installed on its own, during which you will be asked to enter the Local Password

 

Step 2: Install Carthage

On the command terminal, enter the following command and press Enter.

$ brew update$ brew install carthage

  

View version commands after installation

$ carthage version

  

Step 3: Use Carthage

1. Enter the project folder through the terminal:

 

$ cd /Users/cdmac/Desktop/Demos/DemoX8

  

2. Create an empty carthage file:

$ touch Cartfile

  

3. Use xcode to open the cartfile File

$ open -a Xcode Cartfile

  

Add the following content to the opened file:

github "Alamofire/Alamofire" ~> 4.0github "SwiftyJSON/SwiftyJSON"

  

Version description:

~> 3.0 indicates that the latest version is later than version 3.0 but earlier than version 4.0, such as 3.5, 3.9

= 3.0 indicates that version 3.0 is used.

> = 3.0 indicates that version 3.0 or later is used.

If you do not specify a version number, the latest version is automatically used.

 

4. Save and close the cart file and run the command on the terminal.

$ carthage update --platform iOS

  

Carthage will download and compile the required third-party library for you. After the command is executed, a folder named Carthage will be created in your project folder.

The xxx. framework file has been created for you in/Users/cdmac/Desktop/Demos/DemoX8/Carthage/Build/iOS.

Of course, you can also enter this folder through the command line:

$ open Carthage

  

5. Open your project now, click project, select target, and then select General at the top. Drag the required framework file to Linked frameworks and Binaries.

6. Click the Build Phrase tab option to add the corresponding run script.

 

References:

Homebrew installation tutorial

How to Use Carthage-support Carthage for your project

How to Use Carthage to manage iOS dependent Libraries

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.