Environment is one of SwiftUI's unique features that aren't available in UIKit.
This article tells you how to manage the memory of the Environment while developing in SwiftUI.
The article's main points are as follows:
Dispose of any SwiftUI View values not used anymore
Dispose of any UIHostingController references not used anymore
Watch out for memory leaks in:
UIViews used within SwiftUI
references between your UIViews and your environment objects
UIViewControllers presenting the UIHostingControllers
the environment objects themselves
References:
When does a SwiftUI Environment get retained?
Follow me on:
コメント