From aae84babc3bea130735796fa9c3d9e1fcf03c4e8 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Sun, 6 Oct 2019 12:37:37 +0800 Subject: [PATCH 1/2] Support Swift Package Manager --- .gitignore | 6 +++++- Package.swift | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 Package.swift diff --git a/.gitignore b/.gitignore index dc2d49d..db64352 100644 --- a/.gitignore +++ b/.gitignore @@ -63,4 +63,8 @@ fastlane/test_output # After new code Injection tools there's a generated folder /iOSInjectionProject # https://github.com/johnno1962/injectionforxcode -iOSInjectionProject/ \ No newline at end of file +iOSInjectionProject/ + +# SwiftPM +.build +.swiftpm \ No newline at end of file diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..649bb0a --- /dev/null +++ b/Package.swift @@ -0,0 +1,28 @@ +// 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: "libwebp", + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "libwebp", + targets: ["libwebp"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + 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: "libwebp", + dependencies: [], + path: "libwebp/src", + publicHeadersPath: "webp", + cSettings: [.headerSearchPath("../")]) + ] +) From 067fb2ddb3ab7e5b96f8524669d3194709b32e34 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Sun, 6 Oct 2019 12:54:08 +0800 Subject: [PATCH 2/2] Update the readme about Swift Package Manager --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index 1cf03b9..544b82a 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,11 @@ A wrapper for [libwebp](https://github.com/webmproject/libwebp) + Xcode project. This enables Carthage support +This also contains the Swift Package Manager support [![CI Status](http://img.shields.io/travis/SDWebImage/libwebp-Xcode.svg?style=flat)](https://travis-ci.org/SDWebImage/libwebp-Xcode) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/SDWebImage/libwebp-Xcode) +[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg)](https://swift.org/package-manager/) ## Requirements @@ -15,16 +17,47 @@ This enables Carthage support ## Installation +### Carthage + libwebp is (via this repo) available through [Carthage](https://github.com/Carthage/Carthage). ``` github "SDWebImage/libwebp-Xcode" ``` +### SwiftPM + +Libwebp is available through [Swift Package Manager](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg). + +``` +let package = Package( + dependencies: [ + .package(url: "https://github.com/SDWebImage/libwebp-Xcode", from: "1.0.4") + ], + // ... +) +``` + ## Usage Use libwebp as you would normally, this is just a repo that adds an Xcode proj. +For Swift Package Manager user, use the modular import instead of C headers. + ++ Objective-C + +```objective-c +@import libwebp; +``` + ++ Swift + +```swift +import libwebp +``` + ## License libwebp is available under the BSD-3 license. See [the LICENSE file](https://github.com/webmproject/libwebp/blob/master/COPYING) for more info. + +