UIViewControllerRepresentable inside a UIScrollView (List, ScrollView and etc) not working

Hi,

I have a UIViewController that contains a UITextField I am presenting that view controller inside SwiftUI using a UIViewControllerRepresentable and I am able to interact with the text field fine and the view controller lifecycle executes normally if the representable is not presented on any SwiftUI container that internally uses a scroll view on the other hand if I put the representable view inside a SwiftUI view that has a scroll view internally (when the UIKit hierarchy is generated) the text field does not respond to interaction anymore and the only view controller lifecycle method invoked is the viewDidLoad from my view controller the other methods are not executed.

Anyone knows if this is a bug on SwiftUI or if there is any additional setup necessary for UIViewControllerRepresentables?

Thanks in advance.

Did you ever find a solution for this?

I used UIViewControllerRepresentable inside TabView and had a similar issue, viewWillAppear, and viewWillTransition were all not called

For some reason, the Representable has no frame whatsoever when inside a ScrollView, you need to add a fixed frame for it. At least that's what worked for me.

UIViewControllerRepresentable inside a UIScrollView (List, ScrollView and etc) not working
 
 
Q