I found a fix for this issue - I needed to remove the view from the parent when coming back to the main screen, like so:
hostingController.willMove(toParent: nil)
hostingController.view.removeFromSuperview()
hostingController.removeFromParent()
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: