Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- class ViewController: UIViewController {
- @IBOutlet weak var display: UILabel?
- var userIsTyping = false
- @IBAction func touchDigit(_ sender: UIButton) {
- let digit = sender.currentTitle!
- if userIsTyping {
- let textCurrentInDisplay = display!.text! // will not be executed warning
- display!.text = textCurrentInDisplay + digit
- }
- else {
- display!.text = digit
- userIsTyping = true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement