daily pastebin goal
48%
SHARE
TWEET

Untitled

a guest Oct 11th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @IBOutlet weak var messageLabel: UILabel!
  2.  
  3. @IBOutlet weak var activityIndicator: UIActivityIndicatorView!
  4.  
  5. override func viewDidLoad() {
  6.     super.viewDidLoad()
  7.  
  8.     messageLabel.text = ""
  9. }
  10.  
  11. @IBAction func startTestButtonPress(_ sender: UIButton) {
  12.  
  13.     messageLabel.text = "Starting test"
  14.  
  15.     activityIndicator.startAnimating()
  16.  
  17.     DispatchQueue.global(qos: .userInitiated).async { [weak self] in
  18.  
  19.         Thread.sleep(until: Date(timeIntervalSinceNow: 5.0))
  20.  
  21.         DispatchQueue.main.async {
  22.  
  23.             self?.activityIndicator.stopAnimating()
  24.  
  25.             self?.messageLabel.text = "Test completed"
  26.         }
  27.     }
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top