Swift Package integration, delegate callbacks, and example code
The NixDistraction SDK is a Swift Package that adds workplace phone monitoring to your iOS app.
Automatically detects NIX beacons to mark work zone entry and exit
Provides connection/disconnection events to mark work session boundaries
Reports screen lock/unlock events during active sessions
Works seamlessly when your app is not actively running
Simple delegate-based API:
import GPTNixDistraction
let sdk = GPTNixDistraction.shared()
sdk.connectionDelegate = self
sdk.exceptionDelegate = self
func nixConnectionEvent(_ connected: Bool) {
if connected { startWorkSession() }
else { endWorkSession() }
}
func nixExceptionEvent(_ exception: ExceptionType) {
switch exception {
case .screenUnLocked: trackPhonePickup()
case .screenLocked: handleScreenLock()
default: break
}
}
Session boundaries, phone activity, and work vs. distraction time
NIX connected/disconnected events tell you when a work session starts and ends. The SDK debounces connection drops automatically.
Screen unlock events let you count phone pickups during the shift. Track how many times workers check their phone.
Configurable: count only outside-app time as distraction (default), or count all unlocked time. Perfect for maintenance apps where in-app use is the job.
Example WorkSessionTracker included. ~30 lines to track pickups, in-app time, distraction time—ready to upload to your backend.
The complete integration package includes:
Testing Requirements: SDK testing requires a physical iOS device and NIX beacon. The iOS Simulator cannot access Bluetooth hardware. We ship a loaner NIX beacon with your evaluation.