[swift-evolution] Removal of dispatch_once() in Swift 3?

Ben Rimmington me at benrimmington.com
Fri Jun 17 06:51:56 CDT 2016


Ben Rimmington wrote:

> William Shipley wrote:
>
> > I may be missing something, but I don’t understand how to get the behavior
> > of dispatch_once() without a bunch more code in cases in which I was using
> > it to initialize “lazy-ish" instance variables.
>
> In Objective-C, the `dispatch_once_t` predicate *must* be a static or global
> variable (which is automatically initialized to zero).

Greg Parker on Stack Overflow:

<http://stackoverflow.com/a/19845164>

-- Ben


More information about the swift-evolution mailing list