https://github.com/icell/cryptocurrencykit
A Swift crypto-currencies price library for accessing coinmarket APIs
https://github.com/icell/cryptocurrencykit
api blockchain coinmarketcap cryptocurrency swift
Last synced: 8 months ago
JSON representation
A Swift crypto-currencies price library for accessing coinmarket APIs
- Host: GitHub
- URL: https://github.com/icell/cryptocurrencykit
- Owner: iCell
- License: mit
- Created: 2017-09-19T07:28:32.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-19T05:39:03.000Z (over 8 years ago)
- Last Synced: 2025-10-21T07:56:36.884Z (8 months ago)
- Topics: api, blockchain, coinmarketcap, cryptocurrency, swift
- Language: Swift
- Size: 26.4 KB
- Stars: 52
- Watchers: 4
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CryptoCurrencyKit
CryptoCurrencyKit is an API kit based on [CryptoCurrency Market Capitalizations](https://coinmarketcap.com/api/)
## Requirements
- iOS 8.0+ / macOS 10.10+ / tvOS 9.0+
- Xcode 9.0+
- Swift 4.0+
## Installation
### CocoaPods
[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:
```bash
$ gem install cocoapods
```
To integrate CryptoCurrencyKit into your Xcode project using CocoaPods, specify it in your `Podfile`:
```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target '' do
pod 'CryptoCurrencyKit'
end
```
Then, run the following command:
```bash
$ pod install
```
### Carthage
[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
```bash
$ brew update
$ brew install carthage
```
To integrate CryptoCurrencyKit into your Xcode project using Carthage, specify it in your `Cartfile`:
```ogdl
github "iCell/CryptoCurrencyKit"
```
Run `carthage update` to build the framework and drag the built `CryptoCurrencyKit.framework` into your Xcode project.
### Swift Package Manager
The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. It is in early development, but Alamofire does support its use on supported platforms.
Once you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.
```swift
dependencies: [
.Package(url: "https://github.com/iCell/CryptoCurrency.git")
]
```
## Usage
fetch tickers
```Swift
CryptoCurrencyKit.fetchTickers { response in
switch response {
case .success(let data):
print(data)
case .failure(let error):
print(error)
}
}
```
fetch a specific crypto currency
```Swift
CryptoCurrencyKit.fetchTicker(coinName: "BitCoin", convert: .jpy) { response in
switch response {
case .success(let bitCoin):
print(bitCoin.priceJPY)
case .failure(let error):
print(error)
}
}
```
fetch global data
```Swift
CryptoCurrencyKit.fetchGlobal(convert: .cny) { response in
switch response {
case .success(let data):
print(data)
case .failure(let error):
print(error)
}
}
```
## Author
iCell, icell.vip@gmail.com
## License
Alamofire is released under the MIT license. [See LICENSE](https://github.com/iCell/CryptoCurrency/blob/master/LICENSE) for details.