T-Pham / CoinPriceBar

💰 Cryptocurrency prices on MacBook Touch Bar
MIT License
315 stars 45 forks source link

Raiblocks would be amazing! #12

Closed kdthomas2121 closed 6 years ago

kdthomas2121 commented 6 years ago

Some day I'll learn how to add my own!

iln0892 commented 6 years ago

it is easy to add TRON

1) (Data.swift)

let supportedCoins: [Coin] =
     [.BTC, .ETH, .TRX, .XRP, .ADA]

2)(in Money.swift)

enum Coin: String {
  case BTC
  case ETH
  case TRX
  case XRP
  case ADA
}
extension Coin {

  func priceProvider() -> CoinPriceProvider {
    switch self {
    case .XRP, .TRX, .ADA: return BinancePriceProvider()
    default: return CoinbasePriceProvider()
    }
  }
}
extension Coin {

  func unicode() -> String {
    switch self {
    case .BTC: return "â‚¿"
    case .ETH: return "Ξ"
    case .TRX: return "Ï„"
    case .XRP: return "Ʀ"
    case .ADA: return "a̶"
    }
  }

case .TRX: return NSColor(displayP3Red: 182 / 255, green: 180 / 255, blue: 182 / 255, alpha: 1)

kdthomas2121 commented 6 years ago

This can be closed, made a fork and managed to add coins myself, thanks!