You can do what the error says, and use ContentViewProtocol
as a generic constraint. Make showContent
generic:
func showContent<V: ContentViewProtocol>(view: V)
{
let child = UIHostingController(rootView: view)
...
}
CLICK HERE to find out more related problems solutions.