I am a beginner and I am building a RPN calculator. I have disabled the point key (not clickable anymore) if the digit situated in the display has already a point. How can I enable it again after having pressed the enter key? Because now, it stays disabled even if I enter another digit in the display. So if I clicked on the point key once for the first digit, I cannot add a point for the second digit of my operation.
I have that code for to add a point to a digit:
@IBAction func floatingPoint(sender: UIButton) {
labelDisplay.text = labelDisplay.text! + "."
sender.enabled = false //not clickable if the digit as already a point
}
I have that code for enter:
var enterPressed = false
@IBAction func Enter() {
userHasStartedTyping = false
self.calcEngine!.operandStack.append(displayValue)
print("Operand Stack on engine = \(self.calcEngine!.operandStack)")
}
I have that code for the operation:
@IBAction func operation(sender: UIButton) {
let operation = sender.currentTitle!
if userHasStartedTyping {
Enter()
}
self.displayValue = (self.calcEngine?.operate(operation))!
Enter() //
}