If you are happy to squish them, this is my technique.
I move my arm very slowly. Flies perceive human movements as slow in comparison to our own perception, so I tend to move at a glacial pace, so the fly does not detect my movements.
Once I am close enough I wait until the fly is cleaning its legs or eyes before I strike. If the fly stops cleaning it is either aware of me (or another external influence) or it is ready to move off.
Whilst the fly is cleaning I try and overreach, so if the fly is facing away from me, I will swat a few inches ahead of it in anticipation of it moving off, trying to make the move as rapid as possible. It doesn't always work, but I've killed some this way.