Skip to content

Commit 9cca82d

Browse files
committed
Calculator: repair the calculator
Update the state after mutation to ensure that subsequent mutations will see the new state. This allows multi-digit entries again.
1 parent 44f6f52 commit 9cca82d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Examples/Calculator/Calculator.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ private class Calculator {
126126
var operand = self.state[keyPath: self.state.operand] as Decimal
127127
operand *= 10
128128
operand += Decimal(input)
129+
self.state[keyPath: self.state.operand] = operand as NSDecimalNumber
129130

130131
self.txtResult.text = operand.description
131132
}

0 commit comments

Comments
 (0)