Skip to content

crewshin/CoinGecko-Swift

Repository files navigation

Repo image

CoinGecko-Swift

Build & Test License: MIT swift-version

CoinGecko Swift SDK (Based off https://www.coingecko.com/api/documentations/v3)

This is actively WIP at the moment. PR's welcome!

Getting Started

Swift Package Manager (Xcode 11 and above)

  1. Select File/Swift Packages/Add Package Dependency from the menu.
  2. Paste https://github.com/crewshin/CoinGecko-Swift.git.

Why not CocoaPods, or Carthage?

Supporting multiple dependency managers makes maintaining a library exponentially more complicated and time consuming. Furthermore, with the integration of the Swift Package Manager in Xcode 11 and greater, I expect the need for alternative solutions to fade quickly.

Usage

import CoinGecko

Create an instance of CoinGecko:

let gecko = CoinGecko(api: .main)

Then:

gecko.ping() { (result) in
    switch result {
    case .failure(let error):
        if case let APIError.generic(message) = error {
            print(message)
        }
    case .success(let response):
        if let value = response.value {
            print(value)
        }
    }
}

Feel free to say hi on Discord: crewshin#3286

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages