Re: [swift-users] Capture values by Closures in different background threads.

2016-11-30 Thread Jordan Rose via swift-users
When not using a capture list, Swift closures always refer to variables, not to their values. So here you’re not capturing copies, you’re capturing the actual variable ‘test’, and the mutating function will update it. (If you did capture a copy, it would be immutable, and the call to ‘newNum(new

Re: [swift-users] Capture values by Closures in different background threads.

2016-11-30 Thread Jeremy Pereira via swift-users
> On 30 Nov 2016, at 10:38, Седых Александр via swift-users > wrote: > > Assume we have this code: > > Immediately two Timer's closures captured two copy of initial values of > instance Test, with internal num values is 0. > > //: Playground - noun: a place where people can play > > impo