I found the solution to the problem. I want to clarify once again that this issue only occurs with iOS 18+.
I think it's a lifecycle thing. By adding the UIHostingController that contains the SwiftUI view (which in turn contains the Player) as child and notifying the addition to the parent, the player controls become visible again.
New lines:
addChild(hostingController)
hostingController.didMove(toParent: self)
Below is a complete code example:
addChild(hostingController) hostingController.view.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(hostingController.view)
hostingController.didMove(toParent: self)
/// set constraints
Post
Replies
Boosts
Views
Activity
I’m adding some extra info: this problem only happens when the player is in a modal (when is shown by a present).