There's an API in iOS/iPadOS named UIHoverGestureRecognizer, but it only detects hover from cursors and from the Apple Pencil. The Apple Pencil hover is neat and actual "hover" detection in the way you're thinking; it can be detected up to 12mm away from the screen. But right now there's no actual detection for finger hover, even though Apple patented a technique for it almost 10 years ago.