What is the equivalent of @autoreleasepool in Swift?

前端 未结 4 1494
抹茶落季
抹茶落季 2021-02-01 11:35

In Swift, I notice there is no @autoreleasepool{} construct, although Swift does use ARC. What is the proper way to manage an autoreleasepool in Swift, or has it be

4条回答
  •  终归单人心
    2021-02-01 12:33

    Just FYI, Xcode constructed the full code as follows:

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

    Guess the parentheses identifies the functions closure.

提交回复
热议问题