Need Assistance?

support@tutorialshub.in

Functions & Closures

@escaping Closures & [weak self]

ADVERTISEMENT
Swift Free Lesson
5 min read
ADVERTISEMENT

When a closure outlives the function (like an async network callback), mark it @escaping and capture [weak self] to prevent retain cycles (memory leaks) in classes!

ADVERTISEMENT
Hi, I'm Tuby! Here to help you