swift - Do I need [weak self] or [unowned self] for a Singleton in the Closure? -


class test {      private init() {}      static let shared = test()      func test() {      }  }  let closure: ()->void = {     test.shared.test() }  closure() 

the code above simple. want know if have mark weak or unowned singleton. , why?

no, because self not used (explicitly or implicitly) in closure.


Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -