github挂载地址:https://github.com/rs/SDWebImage
Installation with CocoaPods
CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects. See the Get Started section for more details.
Podfile
platform :ios, '6.1'
pod 'SDWebImage', '~>3.7'
If you are using Swift, be sure to add use_frameworks!
and set your target to iOS 8+:
platform :ios, '8.0'
use_frameworks!
Subspecs
There are 3 subspecs available now: Core
, MapKit
and WebP
(this means you can install only some of the SDWebImage modules. By default, you get just Core
, so if you need WebP
, you need to specify it).
Podfile example:
pod 'SDWebImage/WebP'
Installation with Carthage (iOS 8+)
Carthage is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods.
To install with carthage, follow the instruction on Carthage
Cartfile
github "rs/SDWebImage"
Usage
Swift
If you installed using CocoaPods:
import SDWebImage
If you installed manually:
import WebImage
Objective-C
@import WebImage;
Installation by cloning the repository
In order to gain access to all the files from the repository, you should clone it.
git clone --recursive https://github.com/rs/SDWebImage.git
Add the SDWebImage project to your project
- Download and unzip the last version of the framework from the download page
- Right-click on the project navigator and select "Add Files to "Your Project":
- In the dialog, select SDWebImage.framework:
- Check the "Copy items into destination group's folder (if needed)" checkbox
Add dependencies
- In you application project app’s target settings, find the "Build Phases" section and open the "Link Binary With Libraries" block:
- Click the "+" button again and select the "ImageIO.framework", this is needed by the progressive download feature: