Consider this code. It works. And I was just about to answer a commenter with it… But my brain HURTS reading it, even more writing it, and much more recommending that someone else copies it… function SharedApplication: UIApplication; begin Result := ...
More...