Jerry PM
Oct 28, 2024

--

maybe no 14 look like this πŸ€”

for the best case

// BEST CASE:

class ViewController: UIViewController {

// Using weak self to avoid retain cycle

var completion: (() -> Void)? = nil

func setupClosure() {

completion = { [weak self] in

guard let self = self else { return }

// Now we can safely use self here

}

}

}

--

--

No responses yet