Chubby says swift01--------How to use cocoapods imported third-party libraries in swift development

Source: Internet
Author: User

Today, when writing a project with Swift, we need to introduce the cocoapods into the sdwebimage, and start creating the pod file in the VIM command, which requires the CD to be in the directory of the current project before it is created.

Podfile Create the steps as follows:

1. Create Podfile:touch Podfile

2. Edit Podfile file: Vim podfile

Press I to enter the edit state, press ESC to exit the edit state after editing, and then enter: Wq returns,

The contents of the Podfile file are as follows

Platform:ios, ' 7.0 '
use_frameworks!
Target ' Bantang ' do
pod ' sdwebimage '
end
One thing to note is that there is a difference between swift and OC, with use_framework! when configuring the Podfile file in Swift , the role is to package the three-party library into a static library,

Call the three-party library in Swift:

1. Select linked frameworks and Libraries in Target and general, click + Add Sdwebimage.framework


2, after the introduction of the framework, directly in the need to use the Swift class import Sdwebimage,
3, then you can use this three-party library


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.