Custom keyboard input for text field swift
<p><a href="https://i.stack.imgur.com/rk2Sw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rk2Sw.jpg" alt="custom keyboard for tip calculator"></a>
Practicing swift making a tip calculator. I know using a number keyboard would make this a lot easier but I'm wanting this custom "keyboard" or number pad like a calculator app to be able to edit the text field "TotalBill". I know you can do this by updating a label with the button numbers being pressed but there is no user notification that something will happen if you start typing on the buttons.  </p>

<p>I hope that all made sense.  Thanks. </p>

<p>Updated: </p>

<pre><code>var userTyping = false
@IBOutlet weak var totalBill: UITextField!
@IBAction func numberDelete(_ sender: UIButton) {
    if let currentTitle = perPersonTotal.text{
    let updatedTitle = currentTitle.substring(to: (currentTitle.index(before: (currentTitle.endIndex))))
    perPersonTotal.text = updatedTitle
    }
}
@IBOutlet weak var perPersonTotal: UILabel!
@IBAction func touchDigit(_ sender: UIButton) {
    if let digit = sender.currentTitle {
        if userTyping {
            let currentDisplay = perPersonTotal.text!
            perPersonTotal.text = currentDisplay + digit
        } else {
            perPersonTotal.text = digit
        }
        userTyping = true
    }

}
</code></pre>