What is equivalent to @autoreleasepool in Swift?

In Swift, I noticed that there is no @autoreleasepool{} construct, although Swift uses ARC. What is the correct way to manage autoreleasepool in Swift, or was it removed for some reason?

+74
automatic-ref-counting swift nsautoreleasepool
Jun 10 '14 at 22:44
source share
3 answers

This is described in detail in WWDC 2014 video number 418, โ€œImproving Your Application with Tools,โ€ which you can also download as a PDF.

But, in short, the syntax is:

 autoreleasepool { /* code */ } 
+116
Jun 10 '14 at 22:49
source share

Just FYI, Xcode constructed the complete code as follows:

 autoreleasepool({ () -> () in // code }) 

Guess that parentheses indicate closing functions.

+15
Jan 04 '15 at 22:17
source share

There is! It is simply not mentioned anywhere.

 autoreleasepool { Do things.... } 
+7
Jun 10 '14 at 22:48
source share



All Articles