CoinGecko-Swift

main

crewshin/CoinGecko-Swift

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

Description

  • Swift Tools 5.3.0
View More Packages from this Author

Dependencies

  • None
Last updated: Mon Oct 21 2024 16:26:41 GMT-0900 (Hawaii-Aleutian Daylight Time)