Is there a way to use the iPhone proximity sensor to detect whether the phone is in a room with no light?
This question seems to imply that this is not possible...Do
There is much simpler solution for this if anyone needs. Use screen brightness to detect the light conditions:
0 - 0.3 (Dark)
0.4 - 1 (Bright)
Tweak as needed:
switch UIScreen.main.brightness { case 0 ... 0.3: print("LOW LIGHT") default: print("ENOUGH LIGHT") }