How do you manage memory in Swift, and how does ARC (Automatic Reference Counting) work?
Utilisateur anonyme
Swift uses ARC (Automatic Reference Counting) to manage memory. It tracks object references and automatically deallocates objects when no references remain. To avoid retain cycles, especially with closures and delegates, I use [weak self] or unowned. I also regularly check for leaks using Instruments and the Memory Graph Debugger to keep the app memory-efficient.