Objective-C bindings to libgit2
ObjectiveGit provides Cocoa bindings to the libgit2 library, packaged as a dynamic framework for OS X and iOS 8 or better.
A brief summary of the available functionality:
Not all libgit2 features are available, but if you run across something missing, please consider contributing a pull request!
Many classes in the ObjectiveGit API wrap a C struct from libgit2 and expose the underlying data and operations using Cocoa idioms. The underlying libgit2 types are prefixed with
git_and are often accessible via a property so that your application can take advantage of the libgit2 API directly.
The ObjectiveGit API makes extensive use of the Cocoa NSError pattern. The public API is also decorated with nullability attributes so that you will get compile-time feedback of whether nil is allowed or not. This also makes the framework much nicer to use in Swift.
ObjectiveGit requires Xcode 7 or greater to build the framework and run unit tests. Projects that must use an older version of Xcode can use Carthage to install pre-built binaries or download them manually.
To develop ObjectiveGit on its own, open the
There are three ways of including ObjectiveGit in a project:
Carthage/Build/Macfolder on disk.
Carthage/Build/iOSfolder on disk.
and add the paths to the frameworks you want to use under “Input Files”, e.g.:
Under “Build Settings”, add the following to “Header Search Paths”:
git2/filter.h file not founderrors.
The different instructions for iOS works around an App Store submission bug triggered by universal binaries.
dSYM files are not currently included in the GitHub release zip files. You will need to pass --no-use-binaries to carthage in order to build locally and generate the dSYM files alongside the framework.
Carthage/Build/[platform]into the list.
Note that the iOS framework we release is a "fat" framework containing slices for both the iOS Simulator and devices. This makes it easy to get started with your iOS project. However, Apple does not currently allow apps containing frameworks with simulator slices to be submitted to the app store. Carthage (above) already has a solution for this. If you're looking to roll your own, take a look at Realm's strip frameworks script.
git submodule add https://github.com/libgit2/objective-git.git External/ObjectiveGit
ObjectiveGitFramework.xcodeprojfile into the Project Navigator pane of your project.
ObjectiveGit-iOSas a target dependency of your application, depending on platform.
HEADER_SEARCH_PATHS) build setting to the correct path for the libgit2 headers in your project. For example, if you added the submodule to your project as
External/ObjectiveGit, you would set this build setting to
External/ObjectiveGit/External/libgit2/include. If you see build errors saying that
git2/filter.hcannot be found, then double-check that you set this setting correctly.
ObjectiveGit.frameworkto the list. This will package the framework with your application as an embedded private framework.
build/Debugwhereas the iOS framework is in
@import ObjectiveGit;as you would with any other framework.
All contributions should match GitHub's Objective-C coding conventions.
You can see all the amazing people that have contributed to this project here.
ObjectiveGit is released under the MIT license. See the LICENSE file.