화면 밝기를 줄이자 → UIScreen.main.brightness의 값 조절
proximity sensor
UIDevice.current.isProximityMonitoringEnabled = true
문제점
proximity sensor를 막고 있으면, orientation Notification이 발행되지 않음isProximityMonitoringEnabled 을 활성화한다.isProximityMonitoringEnabled 을 비활성화한다.장점
Background 상태로 진입하지 않고 앱 동작이 기존과 동일하게 동작하는 것을 확인
둘 다 사용 ( 화면 밝기 조절 & 화면 자동 끄기)
첫 뒤집음 이전에 밝기를 바꾸고 뒤집으면 바꾼 밝기가 적용되지 않고 초기 밝기가 적용되는 문제점
UIScreen.main.brightness의 값 조절을 통해 밝기 조절을 해주려 했다.UIDevice.current.isProximityMonitoringEnabled = true 로 설정하니 뒤집어져있을 때 디바이스의 face down detection이 작동해 화면이 자동으로 화면이 꺼진다.UIScreen.main.brightness로 조절하는 최소 밝기는 0.0인데 화면이 아예 꺼지진 않아서 face down detection 사용하는 방식으로 수정했다.isProximityMonitoringEnabled을 디바이스의 face Down 상태에서만 활성화해주는 방식으로 로직을 수정했다.