Avatar ·

What is the difference between weak and unowned references in Swift for memory management?

Hi everyone! I'm learning Swift and trying to understand ARC (Automatic Reference Counting). I've read the documentation, but I can't figure out the difference between weak and unowned references. Both of them seem to not increase the reference count, so what's the difference? I have this example. I'm writing a simple app with a user profile and their avatar. When the user leaves the screen, I want the Profile object and its Avatar to be deallocated from memory. But I'm getting a memory leak due to a strong reference cycle. Here's my simplified code: ```swift class Profile { let name: String var avatar: Avatar? init(name: String) { self.name = name print("Profile \(name) created") } deinit { print("Profile \(name) deallocated") } } class Avata