Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.51 KB | None | 0 0
  1. import UIKit
  2.  
  3. class ViewController: UIViewController {
  4.    
  5.     @IBOutlet weak var display: UILabel?
  6.  
  7.     @IBAction func touchDigit(_ sender: UIButton) {
  8.         var userIsTyping = false
  9.         let digit = sender.currentTitle!
  10.         if userIsTyping {
  11.             let textCurrentInDisplay = display!.text! // will not be executed warning
  12.             display!.text = textCurrentInDisplay + digit
  13.         }
  14.         else {
  15.            display!.text = digit
  16.             userIsTyping = true;
  17.         }
  18.     }
  19.  
  20.  
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement