Thanks gfdgdfg for the quick response and solution proposition.
In my specific case, it did not solve the memory leak issue. What helped was resetting the action in updateUIViewController(_ controller: UIAppearViewController, context: Context).
Extending relamquad's answer like this:
swift
struct UIKitAppear: UIViewControllerRepresentable {
let action: () - Void
func makeUIViewController(context: Context) - UIAppearViewController {
let vc = UIAppearViewController()
vc.action = action
return vc
}
func updateUIViewController(_ controller: UIAppearViewController, context: Context) {
controller.action = action
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: