A wrapper for libwebp + Xcode project. Support Carthage && CocoaPods && SwiftPM.
Go to file
DreamPiggy 3dc92b7ea3 Update to v1.3.1 2023-07-26 17:48:10 +08:00
Xcode Fix umbrella header for Carthage build 2023-07-26 17:44:08 +08:00
include Remark the sharpyuv to public header and public include folder 2023-07-26 16:05:24 +08:00
libwebp@fd7bb21c0c Update to v1.3.1 2023-07-26 17:48:10 +08:00
libwebp.xcodeproj Update to v1.3.0 2023-07-26 15:43:28 +08:00
libwebpExample Added Xcode project that builds libwebp as a framework for all 4 platforms + small macos command line example 2018-08-28 15:44:11 +03:00
.gitignore Support Swift Package Manager 2019-10-06 12:37:37 +08:00
.gitmodules Added libwebp dependency 2018-08-28 14:24:53 +03:00
.travis.yml Fix the Travic-CI script because of rubygem version bump, update the readme 2019-12-27 12:14:32 +08:00
Package.swift Update to v1.2.3 2022-08-03 01:34:14 +08:00
README.md Bumped version to 1.3.0 2023-07-26 16:18:18 +08:00
libwebp.podspec Fix CocoaPods podspec again 2023-07-26 17:41:55 +08:00

README.md

libwebp + Xcode

A wrapper for libwebp + Xcode project. This enables Carthage support This also contains the Swift Package Manager support

CI Status Carthage compatible SwiftPM compatible

Requirements

  • iOS 8
  • macOS 10.10
  • tvOS 9.0
  • watchOS 2.0

Installation

CocoaPods

libwebp is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'libwebp'

Carthage

libwebp is (via this repo) available through Carthage.

github "SDWebImage/libwebp-Xcode"

SwiftPM

Libwebp is available through Swift Package Manager.

let package = Package(
    dependencies: [
        .package(url: "https://github.com/SDWebImage/libwebp-Xcode", from: "1.1.0")
    ],
    // ...
)

Usage

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

For Swift Package Manager user, it's recommended to use the modular import instead of C headers.

  • Objective-C
@import libwebp;
// or if you don't use module
#import <webp/decode.h>
#import <webp/encode.h>
  • Swift
import libwebp

About sharpyuv

From libwebp v1.2.3, Google separate some functions into a new standalone lib called sharpyuv. However, it dependeny source code from libwebp repo's src as implementation. Like llvm-project monorepo, one repo host multiple targets.

Before v1.3.0, we hide these headers as internal headers.

From v1.3.0, we expose the sharpyuv public headers, but not a standalone CocoaPods/SPM/Carthage Target. (In the future we may consider separate targets)

If you want to use sharpyuv functions, do something like this:

  • Objective-C
// This does not supports module include
#if __has_include(<sharpyuv/sharpyuv.h>)
#import <sharpyuv/sharpyuv.h>
#else
#import <libwebp/sharpyuv.h> // bundled in libwebp's modulemap
#endif
  • Swift
#if canImport(sharpyuv)
import sharpyuv
#else
import libwebp // bundled in libwebp's modulemap
#endif

License

libwebp is available under the BSD-3 license. See the LICENSE file for more info.