Post

Replies

Boosts

Views

Activity

Discard UIViewControllerRepresentable from memory heap.
I am using NavigationView and NavigationLink in SwiftUI. And as destinations of NavigationView list, I am setting Views they have UIViewControllerRepresentables . When I back from UIViewController to top NavigationView lists, UIViewController still stay in memory heap. And be in trouble, properties in ViewCotroller also is not discard though I set them nil in viewWillDisapper. How can I discard UIViewControllerRepresentable from memory heap? Thank you for read this. struct ContentView: View { var body: some View { NavigationView { VStack { List { NavigationLink( destination: AViewThatHasUIViewControllerRepresentable(), label: { Text("AView") }) NavigationLink( destination: BViewThatHasUIViewControllerRepresentable(), label: { Text("BView") }) } } } } }
1
0
548
Jul ’21