Hiding the status bar on iPhone X

I have an app that hides the status bar, but as per the HIG I want to leave the status bar visible on iPhone X (and more generally on any device where the safe area suggests there's room for it). I'm not sure what the best way to do this is though.


I've seen various proposed solutions online involving examining the safe area, and it seems UIApplication.statusBarFrame could also be used for this. But, it seems there could be issues related to when 'prefersStatusBarHidden' is queried, when the safe area is ready/valid, and so on. (Empirically it seems that, depending on the circumstances, the safe area may not always be valid when 'prefersStatusBarHidden' is queried.)


Since the HIG recommends not hiding the status bar on iPhone X, I'm wondering if there's an official/canonical way of handling this that I've overlooked. Can anyone recommend a reliable solution for this?


[Edit: I suppose "*Not* hiding the status bar on iPhone X" would've been a better title.]

Hiding the status bar on iPhone X
 
 
Q