Once in Swift
Contents
There are times we want to run an action just once. It would be nice if we can encapsulate this
dispatch_once
dispatch_once
is meant to be used for action that runs once and only once
Once
We can have
1 |
class Once { |
Then we can use it like
1 |
class ViewController: UIViewController { |