From 31aaf4a0b075e0641f85b9905343956da7a0bff7 Mon Sep 17 00:00:00 2001 From: Michael Scoff Date: Tue, 21 Nov 2017 10:58:38 -0800 Subject: [PATCH] Consolidate value into one --- .../ViewModels/TransactionCellViewModel.swift | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Trust/Transactions/ViewModels/TransactionCellViewModel.swift b/Trust/Transactions/ViewModels/TransactionCellViewModel.swift index a4a043118..298173f3b 100644 --- a/Trust/Transactions/ViewModels/TransactionCellViewModel.swift +++ b/Trust/Transactions/ViewModels/TransactionCellViewModel.swift @@ -71,11 +71,12 @@ struct TransactionCellViewModel { } var amount: String { - if let operationValue = operationValue { - return operationValue - } - - let value = EthereumConverter.from(value: BInt(transaction.value), to: .ether, minimumFractionDigits: 3) + let value: String = { + if let operationValue = operationValue { + return operationValue + } + return EthereumConverter.from(value: BInt(transaction.value), to: .ether, minimumFractionDigits: 3) + }() switch transaction.direction { case .incoming: return "+\(value)" case .outgoing: return "-\(value)"