Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
extension CercaViewModel: NISessionDelegate
{
...
func session(_ session: NISession, didUpdate nearbyObjects: [NINearbyObject]) -> Void
{
guard let nearbyObject = nearbyObjects.first else
{
return
}
self.distanceToPeer = nearbyObject.distance
if let direction = nearbyObject.direction
{
self.isDirectionAvailable = true
self.directionAngle = direction.x > 0.0 ? 90.0 : -90.0
}
else
{
self.isDirectionAvailable = false
}
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.