Update the readme about the CocoaPods modular headers usage for Swift project

This commit is contained in:
DreamPiggy 2019-01-28 20:13:05 +08:00
parent c08489b16f
commit b01bbbc5e6
1 changed files with 13 additions and 3 deletions

View File

@ -110,19 +110,27 @@ platform :ios, '7.0'
pod 'SDWebImage', '~> 4.0'
```
##### Swift
##### Swift and static framework
If you are using `Swift`, `Xcode 9+` and `CocoaPods` `1.5.0+`, you only need to set your target to `iOS 8+` if you need static library:
Swift project previously have to use `use_frameworks!` to make all Pods into dynamic framework to let CocoaPods works.
However, start with `CocoaPods 1.5.0+` (with `Xcode 9+`), which supports to build both Objective-C && Swift code into static framework. You can use modular headers to use SDWebImage as static framework, without the need of `use_frameworks!`:
```
platform :ios, '8.0'
# Uncomment the next line when you want Pods as static framework
# use_modular_headers!
pod 'SDWebImage', :modular_headers => true
```
If not, you still need to add `use_frameworks!` to use dynamic framework:
See more on [CocoaPods 1.5.0 — Swift Static Libraries](http://blog.cocoapods.org/CocoaPods-1.5.0/)
If not, you still need to add `use_frameworks!` to use SDWebImage as dynamic framework:
```
platform :ios, '8.0'
use_frameworks!
pod 'SDWebImage'
```
#### Subspecs
@ -184,3 +192,5 @@ All source code is licensed under the [MIT License](https://raw.github.com/SDWeb
<p align="center">
<img src="Docs/SDWebImageSequenceDiagram.png" title="SDWebImage sequence diagram">
</p>