static-libgit2

main

Exposes a static XCFramework of libgit2 as a Swift package
bdewey/static-libgit2

static-libgit2

This repository makes it easier to include the C library Libgit2 into an iOS or Mac application. It does not try to provide any sort of nice, Swifty wrapper over the libgit2 APIs.

This repository is heavily indebted to https://github.com/light-tech/LibGit2-On-iOS. However, the LibGit2-On-iOS project doesn't expose the C Language bindings as its own Swift Package, choosing instead to use their framework as a binary target in their Swift Language binding project MiniGit. If you want Swift bindings, you should probably use that project! However, if you want to work directly with the C API, this is the project for you want to start with.

Usage in an Application

If you are writing an iOS or Mac app that needs access to libgit2, you can simply add this package to your project via Swift Package Manager. The libgit2 C Language APIs are provided through the Clibgit2 module, so you can access them with import Clibgit2. For example, the following SwiftUI view will show the libgit2 version:

import Clibgit2
import SwiftUI

struct ContentView: View {
    var body: some View {
        Text(LIBGIT2_VERSION)
            .padding()
    }
}

Usage in another package

If you want to use static-libgit2 in another package (say, to expose some cool Swift bindings to the C API), include the following in your Package.swift:

    dependencies: [
      .package(url: "https://github.com/bdewey/static-libgit2", from: "0.1.0"),
    ],

What's Included

static-libgit2 includes the following libraries:

Library Version
libgit2 1.3.0
openssl 3.0.0
libssh2 1.10.0

This build recipe and the original version of the build script comes from the insightful project https://github.com/light-tech/LibGit2-On-iOS.

Build it yourself

You don't need to depend on this package's pre-built libraries. You can build your own version of the framework.

# You need the tool `wget`
brew install wget
git clone https://github.com/bdewey/static-libgit2
cd static-libgit2
./build-libgit2-framework.sh

Description

  • Swift Tools 5.6.0
View More Packages from this Author

Dependencies

  • None
Last updated: Mon Nov 18 2024 04:20:26 GMT-1000 (Hawaii-Aleutian Standard Time)