A wrapper for libheif + Xcode project. Support Carthage && CocoaPods && SwiftPM.

libheif + Xcode

CI Status Version License Platform SwiftPM compatible Carthage compatible

A wrapper for libheif + Xcode project. This enables Carthage support to build libheif as a framework for Apple's platform.

This repo also including the CocoaPods's spec file to use libheif.


  • iOS 8+
  • macOS 10.10+
  • tvOS 9+
  • watchOS 2+



libheif is (via this repo) available through Carthage.

github "SDWebImage/libheif-Xcode"


libheif is available through CocoaPods.

pod 'libheif'

Swift Package Manager (Xcode 11+)

libheif is available through Swift Package Manager.

let package = Package(
    dependencies: [
        .package(url: "", from: "1.6.1")

HEIF Encoding

libheif itself is not a full function decoder but an abstract layer. It needs libde265 for HEIF decoder support, and x265 for HEIF encoder support.

For CocoaPods user, you can use libx265 subspec to integrate the x265 codec supports for HEIF encoding.

pod 'libheif', :subspecs => ['libde265', 'libx265']

Since most of people's usage of this library is for HEIF decoding, and x265 is under GPLv2 license, we only integrate libheif with the Carthage dependency libde265-Xcode. To use x265 for HEIF encoding, try to build it by your own.

AVIF Decoding

  • aom

libheif from v1.7.0 added the support for AV1 Image File Format (AVIF). To keep the component functional, we only integrate the AVIF support in CocoaPods via libaom subspec.

pod 'libheif', :subspecs => ['libaom']
  • dav1d

libheif from v1.9.0 added the support to use dav1d as AVIF decoder codec.

To use dav1d as decoder codec, use the subspec like this:

pod 'libheif', :subspecs => ['libdav1d']

AVIF Encoding

  • aom

libheif from v1.7.0 added the support to use libaom as the default AVIF encoder codec. However, libaom does not performent so well on most mobile system.

pod 'libheif', :subspecs => ['libaom']
  • rav1e

There is another AVIF encoder codec, rav1e. Which added from v1.8.0 version. For CocoaPods, you can choose to use via librav1e subspec.

pod 'libheif', :subspecs => ['librav1e']


  1. rav1e supports iOS and macOS only, because Rust language does not supports tvOS or watchOS bitcode format.
  2. rav1e only supports AVIF encoding, for AVIF decoding, you can choose to use aom, or dav1d
pod 'libheif', :subspecs => ['libdav1d', 'librav1e']
# or if you prefer aom
pod 'libheif', :subspecs => ['libaom', 'librav1e']
  • svt-av1

libheif from v1.14.0 added the support to use svt-av1 as AVIF decoder and encoder codec.

To use svt-av1 as encoder and decoder codec, use the subspec like this:

pod 'libheif', :subspecs => ['svt-av1']


libheif is available under the terms of the GNU Lesser General Public License. See the LICENSE file for more info.


  • Swift Tools 5.0.0
View More Packages from this Author


Last updated: Mon May 20 2024 10:14:32 GMT-0900 (Hawaii-Aleutian Daylight Time)