Question : run a function only once swift
Answered by : defeated-dormouse-g5ki2n1k57q5
// Declare your "once-only" closure like this
private lazy var myFunction: Void = { // Do something once
}()
...
// Then to execute it, just call
_ = myFunction
Source : | Last Update : Mon, 23 Mar 20