Swift framework to monitor and range iBeacons
Yet another Swift framework to monitor and range iBeacons.
To use a iDevice as a Beacon:
BeaconSender.sharedInstance.startSending("A1111111-B111-C111-D111-E11111111111",
majorID: 1,
minorID: 2,
identifier: "TEST")
The BeaconMonitor class provides different init methods:
init(uuid: NSUUID)
: Listen for Beacons with the given proximity UUIDinit(uuids: [NSUUID])
: Listen for multiple UUIDsinit(beacons: [Beacon])
: Listen for explicit BeaconsExample:
import BeaconMonitor
import CoreLocation
class ListenViewController: UIViewController {
var monitor: BeaconMonitor?
override func viewDidLoad() {
super.viewDidLoad()
monitor = BeaconMonitor(uuid: NSUUID(UUIDString: uuidTextfield.text!)!)
monitor!.delegate = self
monitor!.startListening()
}
}
extension ListenViewController: BeaconMonitorDelegate {
@objc func receivedAllBeacons(monitor: BeaconMonitor, beacons: [CLBeacon]) {
print("All Beacons: \(beacons)")
}
@objc func receivedMatchingBeacons(monitor: BeaconMonitor, beacons: [CLBeacon]) {
print("Matching Beacons: \(beacons)")
}
}
Stop listening:
stopListening()
: Stop listening completlystopListening(uuid: NSUUID)
: Stop listening for a concrete UUIDiBeacon icon in tableView by icons8