Skip to content

Property wrappers for using the Proximity Sensor from the SwiftUI app.

Notifications You must be signed in to change notification settings

0x0001SUI/ProximitySensor

Repository files navigation

ProximitySensor

Property wrappers for using the Proximity Sensor from the SwiftUI app.

import SwiftUI
import ProximitySensor

struct ContentView: View {
    @ProximityMonitoringState private var isProximityMonitoringEnabled: Bool
    @ProximitySensorState private var isProximitySensorClose: Bool
    
    var body: some View {
            Form {
                Toggle("Proximity Monitoring", isOn: $isProximityMonitoringEnabled)
            }
            .onChange(of: isProximitySensorClose) { _ in
                UIImpactFeedbackGenerator(style: .heavy).impactOccurred()
            }
    }
}

About

Property wrappers for using the Proximity Sensor from the SwiftUI app.

Topics

Resources

Stars

Watchers

Forks

Languages