From 4ab0accc7ee79852aa5c108ac06537f8acc66825 Mon Sep 17 00:00:00 2001 From: Oguzhan Gungor Date: Sun, 25 Feb 2018 19:45:57 +1000 Subject: [PATCH] Fixing Linter Warnings --- .../ViewModels/TokenViewCellViewModel.swift | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Trust/Tokens/ViewModels/TokenViewCellViewModel.swift b/Trust/Tokens/ViewModels/TokenViewCellViewModel.swift index 5988eae1a..29e390a9a 100644 --- a/Trust/Tokens/ViewModels/TokenViewCellViewModel.swift +++ b/Trust/Tokens/ViewModels/TokenViewCellViewModel.swift @@ -12,8 +12,8 @@ struct TokenViewCellViewModel { let ticker: CoinTicker? init( - token: TokenObject, - ticker: CoinTicker? + token: TokenObject, + ticker: CoinTicker? ) { self.token = token self.ticker = ticker @@ -39,21 +39,29 @@ struct TokenViewCellViewModel { } var currencyAmount: String? { - guard let ticker = ticker else { return nil } + guard let ticker = ticker else { + return nil + } let tokenValue = CurrencyFormatter.plainFormatter.string(from: token.valueBigInt, decimals: token.decimals).doubleValue let priceInUsd = Double(ticker.price) ?? 0 let amount = tokenValue * priceInUsd - guard amount > 0 else { return nil } + guard amount > 0 else { + return nil + } return CurrencyFormatter.formatter.string(from: NSNumber(value: amount)) } var percentChange: String? { - guard let percent_change_24h = ticker?.percent_change_24h, !percent_change_24h.isEmpty else { return nil } + guard let percent_change_24h = ticker?.percent_change_24h, !percent_change_24h.isEmpty else { + return nil + } return "(" + percent_change_24h + "%)" } var percentChangeColor: UIColor { - guard let ticker = ticker else { return Colors.lightGray } + guard let ticker = ticker else { + return Colors.lightGray + } return ticker.percent_change_24h.starts(with: "-") ? Colors.red : Colors.green } @@ -88,7 +96,7 @@ struct TokenViewCellViewModel { var imageUrl: URL? { return ticker?.imageURL } - + var isStormBird: Bool { return token.isStormBird }