Beacon

public class Beacon : NSObject

A client for monitoring beacon regions.

Beacons are small devices that advertize their location by emitting a BLE (Bluetooth Low Energy) signal in 2.4Ghz frequency range. Beacons can be attached to stationary or moving objects which can then be detected and identified by Trckr.

The Beacon class provides methods for adding and removing beacon regions.

You add a new beacon region with Beacon.addBeacon(proximityUUID:notify:identifier:). When that region is crossed - either exiting or entering that region - Beacon client will call TrckrDelegate.didCross(region:type:withinSchedule:) method.

  • Undocumented

    Declaration

    Swift

    @objc
    public var delegate: BeaconDelegate? { get set }
  • This is the one and only Beacon client instance

    Declaration

    Swift

    @objc
    public static let shared: Beacon
  • This is the default identifier used when adding a new beacon region. You keep that default if your app monitors a single beacon region.

    If your app monitors multiple beacon regions, pass your own identifier to Beacon.addBeacon(proximityUUID:notify:identifier:).

    Declaration

    Swift

    public static let RegionId: String
  • Start monitoring a beacon region.

    Beacon region events are delivered via TrckrDelegate.

    Declaration

    Swift

    public func addBeacon(proximityUUID: UUID, notify: Geofence.RegionTriggerType, identifier: String)

    Parameters

    identifier

    A unique region identifier. You use this identifier to differentiate regions within your application. The default value is Beacon.RegionId.

    proximityUUID

    The unique ID of the beacons being targeted. This value must not be nil.

    notify

    the type of notification to received, i.e. Entry, Exit or both.

    identifier

    A unique region identifier. You use this identifier to differentiate regions within your application. The default value is Beacon.RegionId.

  • Stop monitoring a beacon region.

    Declaration

    Swift

    public func removeBeacon(identifier: String = Beacon.RegionId)

    Parameters

    identifier

    A unique region identifier. You use this identifier to differentiate regions within your application. The default value is Beacon.RegionId.

  • Get an existing monitored beacon region with identifier.

    Declaration

    Swift

    public func monitoredBeacon(identifier: String = Beacon.RegionId) -> CLBeaconRegion?

    Parameters

    identifier

    A unique region identifier. You use this identifier to differentiate regions within your application. The default value is Beacon.RegionId.

  • starts searching for CBPeripherals and reports back found beacons using the BeaconDelegate didDiscover method

    Declaration

    Swift

    public func searchForPeripheral(startingWith: String = "")
  • Undocumented

    Declaration

    Swift

    public func getUUID(peripheral: CBPeripheral)
  • Undocumented

    Declaration

    Swift

    public func changeUUID(peripheral: CBPeripheral, newUUID: UUID)
  • CLBeaconRegions currently monitored by Trckr

    Declaration

    Swift

    public func getMonitoredBeaconRegions() -> [CLBeaconRegion]