Introduction
iBeacon detect manager framework in Swift.
Requirements
- Platforms
- iOS 10.0+
- Swift 5.0
Installation
Carthage
github "daisuke-t-jp/BeaconDetectManager"
CocoaPods
use_frameworks!
target 'target' do
pod 'BeaconDetectManager'
end
Usage
Import Framework
import BeaconDetectManager
Using Delegate
class ViewController: UIViewController, BeaconDetectManagerDelegate // <- ! {
override func viewDidLoad() {
super.viewDidLoad()
BeaconDetectManager.sharedManager.delegate = self // <- !
Start Detecting
Start detect beacon with a proximityUUID. major and minor values will be wildcarded.
BeaconDetectManager.sharedManager.start("YOUR PROXIMITY UUID",
eventOption: [.didEnterRegion, .didExitRegion, .didRangeBeacons])
Start detect beacon with a proximityUUID and major value. minor value will be wildcarded.
BeaconDetectManager.sharedManager.start("YOUR PROXIMITY UUID",
eventOption: [.didEnterRegion, .didExitRegion, .didRangeBeacons],
majorMinorArray: [BeaconDetectManager.MajorMinor(major: 0xabcd)])
Start detect beacon with a proximityUUID and major/minor values.
BeaconDetectManager.sharedManager.start("YOUR PROXIMITY UUID",
eventOption: [.didEnterRegion, .didExitRegion, .didRangeBeacons],
majorMinorArray: [BeaconDetectManager.MajorMinor(major: 0xabcd, minor: 0x0001),
BeaconDetectManager.MajorMinor(major: 0xabcd, minor: 0x0010),
BeaconDetectManager.MajorMinor(major: 0xabcd, minor: 0x0100),
BeaconDetectManager.MajorMinor(major: 0xabcd, minor: 0x1000),
BeaconDetectManager.MajorMinor(major: 0xdcba, minor: 0x0001),
BeaconDetectManager.MajorMinor(major: 0xdcba, minor: 0x0010),
BeaconDetectManager.MajorMinor(major: 0xdcba, minor: 0x0100),
BeaconDetectManager.MajorMinor(major: 0xdcba, minor: 0x1000)])
Implementation Delegate
// Delegate called when disabled location service.
func beaconDetectManagerDidDisableLocationService(_ manager: BeaconDetectManager) {
}
// Delegate called when disabled bluetooth service.
func beaconDetectManagerDidDisableBluetoothService(_ manager: BeaconDetectManager) {
}
// Delegate called when user entered the specified region.
func beaconDetectManager(_ manager: BeaconDetectManager, didEnterRegion region: CLRegion) {
}
// Delegate called when user exited the specified region.
func beaconDetectManager(_ manager: BeaconDetectManager, didEnterRegion region: CLRegion) {
}
// Delegate called when one or more beacons are in range.
func beaconDetectManager(_ manager: BeaconDetectManager, didRangeBeacons beacons: [CLBeacon]) {
}