visit Events
Visit-detection events at the member's gyms: Enter, Exit, Dwell and the session's registration / error events.
Use it to show live arrival and visit feedback - it replaces facilities().geofenceEvents. Events flow only while visit detection is running (startVisitDetection).
Hot SharedFlow; collect from a coroutine in Kotlin, or use subscribeToVisitEvents from Swift.
Android (Kotlin)
lifecycleScope.launch {
AFCore.locations().visitEvents.collect { event ->
when (event) {
is AFGeofenceEvent.Entered -> showArrived(event.geofenceId)
is AFGeofenceEvent.Dwell -> showVisitDetected(event.geofenceId)
else -> Unit
}
}
}Content copied to clipboard
iOS (Swift)
A Kotlin SharedFlow does not bridge to a Swift AsyncSequence; use subscribeToVisitEvents.