Add fake price fetcher for debug mode
This commit is contained in:
39
SatsPrice/Network/PriceSource.swift
Normal file
39
SatsPrice/Network/PriceSource.swift
Normal file
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// PriceSource.swift
|
||||
// SatsPrice
|
||||
//
|
||||
// Created by Terry Yiu on 2/20/24.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
enum PriceSource: CaseIterable, CustomStringConvertible {
|
||||
|
||||
static var allCases: [PriceSource] {
|
||||
#if DEBUG
|
||||
[.coinbase, .coingecko, .fake]
|
||||
#else
|
||||
[.coinbase, .coingecko]
|
||||
#endif
|
||||
}
|
||||
|
||||
case coinbase
|
||||
case coingecko
|
||||
|
||||
#if DEBUG
|
||||
case fake
|
||||
#endif
|
||||
|
||||
var description: String {
|
||||
switch self {
|
||||
case .coinbase:
|
||||
"Coinbase"
|
||||
case .coingecko:
|
||||
"CoinGecko"
|
||||
#if DEBUG
|
||||
case .fake:
|
||||
"Fake"
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user