An alternative question title could be \"How to add an UIHostingController\'s view as subview for an UIView?\".
I am creating a new piece of UI comp
I have some idea in mind.
UIHostingController
Thus:
addChild(hostingViewController)
hostingViewController.view.frame = ...
view.addSubview(hostingViewController.view)
hostingViewController.didMove(toParent: self)
A view controller always uses other view controllers as views.
Stanford CS193P, https://youtu.be/w7a79cx3UaY?t=679
Reference