diff --git a/dydx/dydxPresenters/dydxPresenters/_v4/Trade/Margin/dydxAdjustMarginInputViewBuilder.swift b/dydx/dydxPresenters/dydxPresenters/_v4/Trade/Margin/dydxAdjustMarginInputViewBuilder.swift index 3d4d48299..cd835fa73 100644 --- a/dydx/dydxPresenters/dydxPresenters/_v4/Trade/Margin/dydxAdjustMarginInputViewBuilder.swift +++ b/dydx/dydxPresenters/dydxPresenters/_v4/Trade/Margin/dydxAdjustMarginInputViewBuilder.swift @@ -212,7 +212,8 @@ private class dydxAdjustMarginInputViewPresenter: HostedViewPresenter { - public convenience init(before: AmountTextModel?, after: AmountTextModel?) { + public convenience init(before: AmountTextModel?, after: AmountTextModel?, increasingIsPositiveDirection: Bool = true) { self.init() self.before = before self.after = after + + changeDirection = { [weak self] in + guard let beforeAmount = self?.before?.amount, let afterAmount = self?.after?.amount else { + return .orderedSame + } + if increasingIsPositiveDirection { + return beforeAmount.compare(afterAmount) + } else { + return afterAmount.compare(beforeAmount) + } + } } public required init(unit: AmountTextModel.Unit = .dollar) {