CoinGecko Swift SDK (Based off https://www.coingecko.com/api/documentations/v3)
This is actively WIP at the moment. PR's welcome!
- Select
File
/Swift Packages
/Add Package Dependency
from the menu. - 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.
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