I'm introducing some SwiftUI into a primarily UIKit app and have noticed that, as soon as a SwiftUI view is presented / pushed to the nav stack in its hosting view controller, the memory graph shows a number of Swift closure context (unknown layout)
entries under an <unknown>
header. These entries persist after the SwiftUI view has been popped from the navigation stack.
Is this cause for concern?
I don't think it represents a memory leak within my app, because the entries are grouped under <unknown>
as opposed to my app name. But I'm not entirely sure why they exist (and crucially, why they persist).
It's possible to observe this behaviour with a really simple demo app. Just push the following view:
struct ViewController02: View {
var body: some View {
Text("Hello, world!")
}
}
onto a navigation stack:
self.navigationController?.pushViewController(UIHostingController(rootView: ViewController02()), animated: true)
Any advice / guidance / reassurance would be much appreciated. There can be a considerable number of these entries but I can't see how I could be causing a retain cycle.