Last active
January 21, 2021 16:05
-
-
Save myrickchow32/08131d2c6a77eb9aff61291b1b142e59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@objc func proximityStateDidChange(notification: Notification) { | |
if let device = notification.object as? UIDevice { | |
let currentProximityState = device.proximityState | |
// true: user is close to the device; false: vice versa | |
print("currentProximityState: \(currentProximityState ? "near" : "far")") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment