Cross-platform Swift library for accessing the public GitHub API.


CI Status Code Coverage Latest Release Swift Compatibility Platform Compatibility License

GoatHerb is a cross-platform Swift library for accessing the GitHub API.



  • Compatible with swift-log.
  • Full concurrency (async/await) support.
  • Cross-platform support:
    • iOS
    • macOS
    • tvOS
    • watchOS
    • Linux (optimized for Server-side Swift)

Most cross-platform SDKs simply replace Foundation's URLSession with SwiftNIO's AsyncHTTPClient and call it a day. Not GoatHerb! GoatHerb is built on top of KippleNetworking, which intelligently chooses between Foundation's URLSession or SwiftNIO's AsyncHTTPClient depending on the platform, ensuring optimal networking for the platform it's running on.

GitHub API

  • Get Rate Limit
  • Get User
  • Get Organization
  • Get User Repositories
  • Get Organization Repositories
  • Get Repository

That's it for now! If you're looking for a more feature-complete SDK, check out the list of GitHub SDKs on Swift Package Index.


Create a GitHub object.

let gitHub = GitHub()

You can optionally provide an accessToken in the initializer, or via setting the GITHUB_ACCESS_TOKEN or GITHUB_TOKEN environment variable.

let gitHub = GitHub(accessToken: "<token>")

From there, requests are extremely straight-forward. Here are some examples:

// Get a user.
let user = try await self.gitHub.getUser("bdrelling")

// Get an organization.
let organization = try await self.gitHub.getOrganization("swift-kipple")

// Get all repositories for a user.
let repositories = try await self.gitHub.getRepositories(user: "bdrelling")

// Get all repositories for an organization.
let repositories = try await self.gitHub.getRepositories(org: "swift-kipple")


Discussions, issues, and pull requests are more than welcome! I'm happy to extend the functionality of this library, with respect to the features listed in the Out of Scope section.

If opening a pull request, please ensure that the package retains as close to 100% code coverage as possible.


Special thanks to @boiarqin for providing me with an unforgettable repository name.


This project is released under the MIT license. See LICENSE for details.


  • Swift Tools 5.3.0
View More Packages from this Author


Last updated: Sun Jun 16 2024 21:20:09 GMT-0900 (Hawaii-Aleutian Daylight Time)