Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ChandraGillellamudi
Created November 18, 2020 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChandraGillellamudi/fec9061629743e307c5a18057968ac87 to your computer and use it in GitHub Desktop.
Save ChandraGillellamudi/fec9061629743e307c5a18057968ac87 to your computer and use it in GitHub Desktop.
let estimoteCloudCredentials = CloudCredentials(appID: "MYAPPID", appToken: "MYAPPTOKEN")
proximityObserver = ProximityObserver(credentials: estimoteCloudCredentials, onError: { error in
print("ProximityObserver error: \(error)")
})
let zone = ProximityZone(tag: "Tag1", range: ProximityRange(desiredMeanTriggerDistance: 10.0)!)
zone.onEnter = { zoneContext in
self.appdelegate.window?.makeToast("near \(zoneContext.tag)", duration: 3.0)
}
zone.onExit = { zoneContext in
self.appdelegate.window?.makeToast("left \(zoneContext.tag)", duration: 3.0)
}
let zone1 = ProximityZone(tag: "Tag2", range: ProximityRange(desiredMeanTriggerDistance: 10.0)!)
zone1.onEnter = { zoneContext in
self.appdelegate.window?.makeToast("near \(zoneContext.tag)", duration: 3.0)
}
zone1.onExit = { zoneContext in
self.appdelegate.window?.makeToast("left \(zoneContext.tag)", duration: 3.0)
}
proximityObserver.startObserving([zone,zone1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment