Why does autoFocusRangeRestriction have no effect?

You can tell the iPhone camera to focus on near or far objects by doing:

try! device.lockForConfiguration() defer { device.unlockForConfiguration() } device.autoFocusRangeRestriction = .near

But whether I set near, far or leave it unset makes absolutely no difference. I tested on two different phones — iPhone XS and X — and gave it to two different colleagues to test in case I was doing something wrong.


We tested scenes in which part of the frame was near and the rest far, in both day and night. We expected that setting the range restriction to near causes the near part to be in focus and likewise for the far part. But it never works. Why?


In case it matters, I'm changing the range restriction after the device has been added to the session and the session is running.


I also tried forcing the AF algorithm to run after setting the range restriction by doing

device.focusMode = .continuousAutoFocus
but it doesn't make a difference.