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