Beacon Box
Features
- Scan iBeacons
- Stop Scanning
- Calculate Distance with Accuuracy
- Act as a iBeacon
Installation
To run the example project, clone the repo, and run pod install
from the Example directory first.
BeaconBox is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'BeaconBox'
Procedure
Pre-requisite
- Add CoreLocation Authorization Key in your project's Info.plist
- NSLocationWhenInUseUsageDescription
- NSLocationAlwaysUsageDescription
- NSLocationAlwaysAndWhenInUseUsageDescription
- UUID of your iBeacons
Scan iBeacons
// Note: Check with your iBeacon Manufacture for UUID of iBeacons
if let myUUID = UUID(uuidString: "f7826da6-4fa2-4e98-8024-bc5b71e0893e") {
BeaconBox.shared.scan(uuid: myUUID) { (beacons, error) in
guard let beaconError == error else {
// onFail
print(beaconError)
return
}
// onSuccess
print("Found Beacons : \(beacons.count)")
}
Stop Scanning
BeaconBox.shared.stop(onCompletion: { (status) in
if status {
print("Successfully Stoped ...")
}
}
})
Versions
v1.0.2
- Added Example
- Updated README
- Scan iBeacons
- Stop Scanning
- Calculate Distance with Accuuracy
Author
Abhishek Kumar Ravi
License
BeaconBox is available under the MIT license. See the LICENSE file for more info.