Merge pull request #28 from SDWebImage/swiftpm
Support Swift Package Manager (with libwebp v1.1.0-rc2)
This commit is contained in:
commit
a14f6eb29c
|
@ -65,3 +65,7 @@ fastlane/test_output
|
||||||
# https://github.com/johnno1962/injectionforxcode
|
# https://github.com/johnno1962/injectionforxcode
|
||||||
|
|
||||||
iOSInjectionProject/
|
iOSInjectionProject/
|
||||||
|
|
||||||
|
# SwiftPM
|
||||||
|
.swiftpm
|
||||||
|
.build
|
||||||
|
|
13
.travis.yml
13
.travis.yml
|
@ -1,5 +1,5 @@
|
||||||
language: objective-c
|
language: objective-c
|
||||||
osx_image: xcode9.4
|
osx_image: xcode11.2
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
|
@ -15,10 +15,9 @@ notifications:
|
||||||
before_install:
|
before_install:
|
||||||
- env
|
- env
|
||||||
- locale
|
- locale
|
||||||
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
|
- gem install cocoapods --no-document --quiet
|
||||||
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
|
- gem install xcpretty --no-document --quiet
|
||||||
- pod --version
|
- pod --version
|
||||||
- pod setup --silent > /dev/null
|
|
||||||
- pod repo update --silent
|
- pod repo update --silent
|
||||||
- xcpretty --version
|
- xcpretty --version
|
||||||
- xcodebuild -version
|
- xcodebuild -version
|
||||||
|
@ -32,13 +31,15 @@ script:
|
||||||
|
|
||||||
- echo Build example
|
- echo Build example
|
||||||
- pod install --project-directory=Example
|
- pod install --project-directory=Example
|
||||||
- xcodebuild build clean -workspace SDWebImageWebPCoder.xcworkspace -scheme SDWebImageWebPCoderExample -sdk iphonesimulator -destination 'name=iPhone 6s' -configuration Debug | xcpretty -c
|
- xcodebuild build clean -workspace SDWebImageWebPCoder.xcworkspace -scheme SDWebImageWebPCoderExample -sdk iphonesimulator -destination 'name=iPhone 11 Pro' -configuration Debug | xcpretty -c
|
||||||
|
|
||||||
|
- echo Clean DerivedData
|
||||||
|
- rm -rf ~/Library/Developer/Xcode/DerivedData/
|
||||||
- mkdir DerivedData
|
- mkdir DerivedData
|
||||||
|
|
||||||
- echo Run the tests
|
- echo Run the tests
|
||||||
- pod install --project-directory=SDWebImageWebPCoderTests
|
- pod install --project-directory=SDWebImageWebPCoderTests
|
||||||
- xcodebuild test -workspace SDWebImageWebPCoder.xcworkspace -scheme 'SDWebImageWebPCoderTests' -sdk iphonesimulator -destination 'name=iPhone 6s' -configuration Debug | xcpretty -c
|
- xcodebuild clean test -workspace SDWebImageWebPCoder.xcworkspace -scheme 'SDWebImageWebPCoderTests' -sdk iphonesimulator -destination 'name=iPhone 11 Pro' -configuration Debug -UseModernBuildSystem=NO | xcpretty -c
|
||||||
- mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/iOS
|
- mv ~/Library/Developer/Xcode/DerivedData/ ./DerivedData/iOS
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"object": {
|
||||||
|
"pins": [
|
||||||
|
{
|
||||||
|
"package": "libwebp",
|
||||||
|
"repositoryURL": "https://github.com/SDWebImage/libwebp-Xcode.git",
|
||||||
|
"state": {
|
||||||
|
"branch": null,
|
||||||
|
"revision": "cad41dc4f84bbf13bfe2f3acf85c58d1cb316ea0",
|
||||||
|
"version": "1.1.0-rc2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"package": "SDWebImage",
|
||||||
|
"repositoryURL": "https://github.com/SDWebImage/SDWebImage.git",
|
||||||
|
"state": {
|
||||||
|
"branch": null,
|
||||||
|
"revision": "7ef9a314b12c1a31edb0d09d41fcba93143fe772",
|
||||||
|
"version": "5.4.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"version": 1
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
// swift-tools-version:5.0
|
||||||
|
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||||
|
|
||||||
|
import PackageDescription
|
||||||
|
|
||||||
|
let package = Package(
|
||||||
|
name: "SDWebImageWebPCoder",
|
||||||
|
platforms: [
|
||||||
|
.macOS(.v10_10), .iOS(.v8), .tvOS(.v9), .watchOS(.v2)
|
||||||
|
],
|
||||||
|
products: [
|
||||||
|
// Products define the executables and libraries produced by a package, and make them visible to other packages.
|
||||||
|
.library(
|
||||||
|
name: "SDWebImageWebPCoder",
|
||||||
|
targets: ["SDWebImageWebPCoder"]),
|
||||||
|
],
|
||||||
|
dependencies: [
|
||||||
|
// Dependencies declare other packages that this package depends on.
|
||||||
|
// .package(url: /* package url */, from: "1.0.0"),
|
||||||
|
.package(url: "https://github.com/SDWebImage/SDWebImage.git", from: "5.1.0"),
|
||||||
|
.package(url: "https://github.com/SDWebImage/libwebp-Xcode.git", from: Version(1, 1, 0, prereleaseIdentifiers: ["-rc.2"]))
|
||||||
|
],
|
||||||
|
targets: [
|
||||||
|
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||||
|
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
|
||||||
|
.target(
|
||||||
|
name: "SDWebImageWebPCoder",
|
||||||
|
dependencies: ["SDWebImage", "libwebp"],
|
||||||
|
path: ".",
|
||||||
|
sources: ["SDWebImageWebPCoder/Classes"],
|
||||||
|
publicHeadersPath: "SDWebImageWebPCoder/Classes"
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
13
README.md
13
README.md
|
@ -4,6 +4,7 @@
|
||||||
[![Version](https://img.shields.io/cocoapods/v/SDWebImageWebPCoder.svg?style=flat)](http://cocoapods.org/pods/SDWebImageWebPCoder)
|
[![Version](https://img.shields.io/cocoapods/v/SDWebImageWebPCoder.svg?style=flat)](http://cocoapods.org/pods/SDWebImageWebPCoder)
|
||||||
[![License](https://img.shields.io/cocoapods/l/SDWebImageWebPCoder.svg?style=flat)](http://cocoapods.org/pods/SDWebImageWebPCoder)
|
[![License](https://img.shields.io/cocoapods/l/SDWebImageWebPCoder.svg?style=flat)](http://cocoapods.org/pods/SDWebImageWebPCoder)
|
||||||
[![Platform](https://img.shields.io/cocoapods/p/SDWebImageWebPCoder.svg?style=flat)](http://cocoapods.org/pods/SDWebImageWebPCoder)
|
[![Platform](https://img.shields.io/cocoapods/p/SDWebImageWebPCoder.svg?style=flat)](http://cocoapods.org/pods/SDWebImageWebPCoder)
|
||||||
|
[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager/)
|
||||||
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/SDWebImage/SDWebImageWebPCoder)
|
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/SDWebImage/SDWebImageWebPCoder)
|
||||||
|
|
||||||
Starting with the SDWebImage 5.0 version, we moved the WebP support code and [libwebp](https://github.com/webmproject/libwebp) from the Core Repo to this stand-alone repo.
|
Starting with the SDWebImage 5.0 version, we moved the WebP support code and [libwebp](https://github.com/webmproject/libwebp) from the Core Repo to this stand-alone repo.
|
||||||
|
@ -35,6 +36,18 @@ SDWebImageWebPCoder is available through [Carthage](https://github.com/Carthage/
|
||||||
github "SDWebImage/SDWebImageWebPCoder"
|
github "SDWebImage/SDWebImageWebPCoder"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Swift Package Manager (Xcode 11+)
|
||||||
|
|
||||||
|
SDWebImageWebPCoder is available through [Swift Package Manager](https://swift.org/package-manager).
|
||||||
|
|
||||||
|
```swift
|
||||||
|
let package = Package(
|
||||||
|
dependencies: [
|
||||||
|
.package(url: "https://github.com/SDWebImage/SDWebImageWebPCoder.git", from: "0.3.0")
|
||||||
|
]
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Add Coder
|
### Add Coder
|
||||||
|
|
|
@ -6,7 +6,11 @@
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if __has_include(<SDWebImage/SDWebImage.h>)
|
||||||
#import <SDWebImage/SDWebImage.h>
|
#import <SDWebImage/SDWebImage.h>
|
||||||
|
#else
|
||||||
|
@import SDWebImage;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Built in coder that supports WebP and animated WebP
|
Built in coder that supports WebP and animated WebP
|
||||||
|
|
|
@ -7,12 +7,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "SDImageWebPCoder.h"
|
#import "SDImageWebPCoder.h"
|
||||||
#import <SDWebImage/SDImageCoderHelper.h>
|
|
||||||
#if __has_include(<SDWebImage/NSImage+Compatibility.h>)
|
|
||||||
#import <SDWebImage/NSImage+Compatibility.h>
|
|
||||||
#endif
|
|
||||||
#import <SDWebImage/UIImage+Metadata.h>
|
|
||||||
#import <SDWebImage/UIImage+ForceDecode.h>
|
|
||||||
|
|
||||||
#if __has_include("webp/decode.h") && __has_include("webp/encode.h") && __has_include("webp/demux.h") && __has_include("webp/mux.h")
|
#if __has_include("webp/decode.h") && __has_include("webp/encode.h") && __has_include("webp/demux.h") && __has_include("webp/mux.h")
|
||||||
#import "webp/decode.h"
|
#import "webp/decode.h"
|
||||||
|
@ -24,6 +18,8 @@
|
||||||
#import <libwebp/encode.h>
|
#import <libwebp/encode.h>
|
||||||
#import <libwebp/demux.h>
|
#import <libwebp/demux.h>
|
||||||
#import <libwebp/mux.h>
|
#import <libwebp/mux.h>
|
||||||
|
#else
|
||||||
|
@import libwebp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#import <Accelerate/Accelerate.h>
|
#import <Accelerate/Accelerate.h>
|
||||||
|
|
|
@ -6,7 +6,11 @@
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if __has_include(<SDWebImage/SDWebImage.h>)
|
||||||
#import <SDWebImage/SDWebImage.h>
|
#import <SDWebImage/SDWebImage.h>
|
||||||
|
#else
|
||||||
|
@import SDWebImage;
|
||||||
|
#endif
|
||||||
|
|
||||||
// This category is just use as a convenience method. For more detail control, use methods in `UIImage+MultiFormat.h` or directlly use `SDImageCoder`
|
// This category is just use as a convenience method. For more detail control, use methods in `UIImage+MultiFormat.h` or directlly use `SDImageCoder`
|
||||||
@interface UIImage (WebP)
|
@interface UIImage (WebP)
|
||||||
|
|
|
@ -105,7 +105,6 @@ const int64_t kAsyncTestTimeout = 5;
|
||||||
SDAnimatedImage *image = [SDAnimatedImage imageWithData:animatedImageData];
|
SDAnimatedImage *image = [SDAnimatedImage imageWithData:animatedImageData];
|
||||||
imageView.image = image;
|
imageView.image = image;
|
||||||
XCTAssertNotNil(imageView.image);
|
XCTAssertNotNil(imageView.image);
|
||||||
XCTAssertNotNil(imageView.currentFrame); // current frame
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)test32AnimatedImageViewCategoryProgressive {
|
- (void)test32AnimatedImageViewCategoryProgressive {
|
||||||
|
|
Loading…
Reference in New Issue