---
title: lynnswap/zdlibffi
framework: Swift Package Catalog
role: article
path: packages/lynnswap/zdlibffi
---

# lynnswap/zdlibffi

`ZDLibffi` packages [libffi v3.8.0](https://github.com/libffi/libffi/releases/tag/v3.8.0) for Apple platforms and supports modular imports.

## Introduction

`ZDLibffi` packages [libffi v3.8.0](https://github.com/libffi/libffi/releases/tag/v3.8.0) for Apple platforms and supports modular imports.

## Installation

### CocoaPods

Add the pod in your `Podfile`:

```ruby pod 'ZDLibffi' ```

### Swift Package Manager

Add the dependency in your `Package.swift`:

```swift dependencies: [     .package(url: "https://github.com/faimin/ZDLibffi.git", from: "0.380.0") ] ```

Or add it via Xcode: File → Add Package Dependencies, then enter the repository URL.

## CI

This project uses GitHub Actions for continuous integration. The workflow runs automatically on pushes to `main`/`master` and on all pull requests.

### What CI Checks

| Job | Description | |-----|-------------| | **Pod Lib Lint** | Validates the podspec on each Apple platform (ios, macos, watchos, tvos, visionos), both with and without modular headers | | **SPM Build** | Validates `Package.swift` and builds the package with SwiftPM |

### Running CI Locally

You can replicate the CI checks on your machine:

```bash # CocoaPods lint (replace PLATFORM with ios/macos/watchos/tvos/visionos) pod lib lint ZDLibffi.podspec --allow-warnings --platforms=ios --skip-tests pod lib lint ZDLibffi.podspec --allow-warnings --platforms=ios --use-modular-headers --skip-tests

# SwiftPM swift package describe swift build

# Check arm64/arm64e code generation and run scalar, aggregate, and closure calls python3 scripts/test_pointer_authentication.py ```

With a toolchain that supports arm64e.x1, add `--architectures arm64 arm64e arm64e.x1` to check that slice's code generation too. Cross-compilation does not replace execution on supported hardware. `Tests/PointerAuthentication.c` can also be compiled with `ZD_TEST_NO_MAIN` and called from a signed device test host.

### Triggering CI

- Push to `main` or `master` branch - Open or update a pull request targeting any branch

## One-Click Upgrade

Use the built-in script to upgrade libffi source and regenerate the xcframework:

```bash ./scripts/upgrade_libffi.sh --libffi-version 3.8.0 --pod-version 0.380.0 ```

What this script does:

1. Downloads the official `libffi` release tarball. 2. Regenerates `Source/` headers and source files for modern Apple architectures. 3. Builds `XCFramework/ZDLibffi.xcframework`. 4. Updates version references in `ZDLibffi.podspec` and `README.md`.

Options:

| Flag | Description | |------|-------------| | `--libffi-version` | Target libffi version (e.g. `3.8.0`) | | `--pod-version` | Pod version string (defaults to `0.<version_digits>.0`) | | `--skip-xcframework` | Skip the xcframework build step |

### Upgrade via CI

You can also upgrade without a local environment. Go to **Actions → Upgrade libffi → Run workflow**, enter the target version number (e.g. `3.8.0`), and a PR will be created automatically with:

- Regenerated `Source/` from the new release - Updated version references in podspec and README - SPM build verification

## XCFramework

`ZDLibffi.xcframework` is no longer committed to the repository. You can build it locally or download it from a release.

### Build Locally

```bash python3 scripts/build_xcframework.py \   --source Source \   --output XCFramework/ZDLibffi.xcframework \   --build-dir build/xcframework ```

### Download from Release

Pushing a tag triggers CI to build the xcframework for all platforms and publish it as a GitHub Release asset (`ZDLibffi.xcframework.zip`).

### Supported Slices

- iOS (device) - iOS Simulator - macOS - Mac Catalyst - tvOS (device) - tvOS Simulator - watchOS (device) - watchOS Simulator - visionOS (device) - visionOS Simulator

## Author

faimin, fuxianchao@gmail.com

## Thanks

- [how to compile for iOS](https://github.com/libffi/libffi/issues/510#issuecomment-654689416)

## License

ZDLibffi is available under the MIT license. See the LICENSE file for more info.

## Package Metadata

Repository: lynnswap/zdlibffi

Default branch: main

README: README.md
