Skip to content

Commit

Permalink
update Timer
Browse files Browse the repository at this point in the history
  • Loading branch information
pro648 committed Feb 6, 2021
1 parent 4540370 commit 090ae99
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Timer/Timer/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ class ViewController: UIViewController {
// Do any additional setup after loading the view.

navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(presentAlertController(_:)))

DispatchQueue.global(qos: .userInteractive).async {
// 添加到全局队列当前线程,由于当前线程没有runloop,下面计时器不会触发。
Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { (timer) in
print(timer.fireDate.description)
}
}
}
}

Expand Down

0 comments on commit 090ae99

Please sign in to comment.