Skip to content

Commit 19c48d9

Browse files
authored
Merge pull request #3 from SDWebImage/swiftpm
Support Swift Package Manager
2 parents c7e156d + 067fb2d commit 19c48d9

File tree

3 files changed

+66
-1
lines changed

3 files changed

+66
-1
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,8 @@ fastlane/test_output
6363
# After new code Injection tools there's a generated folder /iOSInjectionProject
6464
# https://github.com/johnno1962/injectionforxcode
6565

66-
iOSInjectionProject/
66+
iOSInjectionProject/
67+
68+
# SwiftPM
69+
.build
70+
.swiftpm

Package.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// swift-tools-version:5.0
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "libwebp",
8+
products: [
9+
// Products define the executables and libraries produced by a package, and make them visible to other packages.
10+
.library(
11+
name: "libwebp",
12+
targets: ["libwebp"]),
13+
],
14+
dependencies: [
15+
// Dependencies declare other packages that this package depends on.
16+
// .package(url: /* package url */, from: "1.0.0"),
17+
],
18+
targets: [
19+
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
20+
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
21+
.target(
22+
name: "libwebp",
23+
dependencies: [],
24+
path: "libwebp/src",
25+
publicHeadersPath: "webp",
26+
cSettings: [.headerSearchPath("../")])
27+
]
28+
)

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
A wrapper for [libwebp](https://github.com/webmproject/libwebp) + Xcode project.
44
This enables Carthage support
5+
This also contains the Swift Package Manager support
56

67
[![CI Status](http://img.shields.io/travis/SDWebImage/libwebp-Xcode.svg?style=flat)](https://travis-ci.org/SDWebImage/libwebp-Xcode)
78
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/SDWebImage/libwebp-Xcode)
9+
[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg)](https://swift.org/package-manager/)
810

911
## Requirements
1012

@@ -15,16 +17,47 @@ This enables Carthage support
1517

1618
## Installation
1719

20+
### Carthage
21+
1822
libwebp is (via this repo) available through [Carthage](https://github.com/Carthage/Carthage).
1923

2024
```
2125
github "SDWebImage/libwebp-Xcode"
2226
```
2327

28+
### SwiftPM
29+
30+
Libwebp is available through [Swift Package Manager](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg).
31+
32+
```
33+
let package = Package(
34+
dependencies: [
35+
.package(url: "https://github.com/SDWebImage/libwebp-Xcode", from: "1.0.4")
36+
],
37+
// ...
38+
)
39+
```
40+
2441
## Usage
2542

2643
Use libwebp as you would normally, this is just a repo that adds an Xcode proj.
2744

45+
For Swift Package Manager user, use the modular import instead of C headers.
46+
47+
+ Objective-C
48+
49+
```objective-c
50+
@import libwebp;
51+
```
52+
53+
+ Swift
54+
55+
```swift
56+
import libwebp
57+
```
58+
2859
## License
2960

3061
libwebp is available under the BSD-3 license. See [the LICENSE file](https://github.com/webmproject/libwebp/blob/master/COPYING) for more info.
62+
63+

0 commit comments

Comments
 (0)