Skip to main content

Overview

The Synheart Behavior Swift/iOS SDK captures digital interaction events on-device — the eight BehaviorEventType cases are scroll, tap, swipe, appSwitch, notification, call, typing, and clipboard — and streams them to your app. Behavior is content-free — no text, no screen content, no PII. The SDK is an input layer: it produces events and raw per-session counts. It does not compute focus, distraction or typing aggregates; that is done downstream by Synheart Core when behavior is fed into it.

Installation

Swift Package Manager

Add to your Package.swift or in Xcode (File → Add Packages…):

Requirements

  • iOS 13.0+ or macOS 10.15+
  • Swift 5.9+ (Xcode 15+)

Quick Start

summary.behavioralMetricsStruct, summary.typingSessionSummary and summary.motionState are always nil: the SDK reports raw counts and leaves scoring to Synheart Core.

Clipboard events

The SDK does not observe the system clipboard. Report copy, paste and cut yourself (for example from a UITextField subclass that overrides copy(_:), paste(_:) and cut(_:)):

Notifications and calls

  • Notifications: forward your UNUserNotificationCenterDelegate callbacks to behavior.notificationDelivered(id:) and behavior.notificationOpened(id:). Or set BehaviorConfig(installNotificationDelegate: true) and the SDK installs itself as the delegate, forwarding every callback to the delegate it replaced.
  • Calls: collected through CallKit when enableAttentionSignals is on.
  • Permissions: checkNotificationPermission(), requestNotificationPermission(), checkCallPermission() and requestCallPermission() are async and return Bool.

Raw motion

enableMotionLite is accepted but collects nothing on iOS yet. For raw accelerometer data, set emitRawMotionSamples: true and register a handler; samples arrive at 50 Hz in 1-second batches:

Event behavior

  • Taps and long press: Not counted when a text field or text view is first responder (keyboard open), so typing is not double-counted as taps.
  • Typing events: carry timing metrics (speed, cadence, gaps, burstiness) and backspace_count. No characters are ever captured.

Errors

Calls throw BehaviorError: notInitialized, invalidConfiguration or sessionNotFound.

API summary

Resources