Skip to content

Instantly share code, notes, and snippets.

@malcommac
Created May 1, 2016 09:44
Show Gist options
  • Select an option

  • Save malcommac/99442cd17d31f325d75105a6a12d5cf9 to your computer and use it in GitHub Desktop.

Select an option

Save malcommac/99442cd17d31f325d75105a6a12d5cf9 to your computer and use it in GitHub Desktop.
Beacon Monitor with SwiftLocation
// MONITOR BEACON FAMILY
let request = BeaconManager.shared.monitorForBeaconFamily(proximityUUID: familyUUID, onRangingBeacons: { beaconsFound in
// beaconsFound is an array of found beacons ([CLBeacon])
}) { error in
// something bad happened
}
// Sometimes in the future you may decide to stop observing
request.stop()
// MONITOR BEACON
let request = BeaconManager.shared.monitorForBeacon(proximityUUID: familyUUID, major: majorID, minor: minorID, onFound: { beaconsFound in
// beaconsFound is an array of found beacons ([CLBeacon]) but in this case it contains only one beacon
}) { error in
// something bad happened
}
// Sometimes in the future you may decide to stop observing
request.stop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment