ProximityMonitor
public class ProximityMonitor : BaseNotificationMonitor
A ProximityMonitor
instance monitors the device for changes to the
state of its proximity sensor.
-
Encapsulates changes to the state of the proximity sensor.
See moreDeclaration
Swift
public enum Event
-
Initializes a new
ProximityMonitor
.Declaration
Swift
public init(queue: OperationQueue = .main, handler: @escaping (Event) -> Void)
Parameters
queue
The operation queue on which the handler executes. By default, the main operation queue is used.
handler
The handler to call when the state of the proximity sensor changes.
-
A Boolean value indicating whether proximity monitoring is available on the device.
Declaration
Swift
public private(set) lazy var isAvailable: Bool { get set }
-
A Boolean value indicating whether the proximity sensor is close to the user (
true
) or not (false
).Declaration
Swift
public var state: Bool { get }
-
Declaration
Swift
override public func addNotificationObservers()
-
Declaration
Swift
override public func removeNotificationObservers()