• ibeacon swift

    In this Blog I'll explain how to make an iPhone device act as a iBeacon emitter using swift.

    iBeacons are devices allow Mobiles to listen signals  and built upon technology of BLE (i.e Bluetooth Low Energy).

    BLE operates on very low energy and use to transmit data in short distance . It transmit data in small packets (or Advertisement) at regular interval and has a one way communication support.

    Beacons can broadcast at range of 110 meters

    Format of BLE Advertising :

    1. UUID : To uniquely identify large number of  Beacon (related to each other).

    2. Minor : To uniquely identify beacons.

    3. Major : To differentiate sets of beacons from large number of beacons.


    Steps to Implement Beacon broadcast :

    Step 1. Import  CoreBluetooth and CoreLocation framework.


    import CoreBluetooth
    import CoreLocation 


    Step 2. Conform to CBPeripheralManagerDelegate.  

    Step 3. Create instance of CLBeaconRegion and CBPeripheralManager class.


    var beacon: CLBeaconRegion!
    var data: NSDictionary!
    var peripheralManager: CBPeripheralManager!


    Step 4. To create and  start broadcasting call the below code  :


    func startBeacon() {
        let UUID = "6B5CDERF-285F-5TAC-A814-092E88G6C8F6"
        let major: CLBeaconMajorValue = 567
        let minor: CLBeaconMinorValue = 987
        beacon = CLBeaconRegion(proximityUUID:  NSUUID(uuidString: UUID)!, major: major, minor: minor, identifier: "IDENTIFIER")
        data = beacon.peripheralDataWithMeasuredPower(nil)
        peripheralManager = CBPeripheralManager(delegate: self, queue: nil, options: nil)


    Step 5. To stop broadcast.


    func stopBeacon() {
        peripheralManager = nil
        data = nil
        beacon = nil


    Step 6. Implement peripheralManagerDidUpdateState() func to handle change in Bluetooth services.




Tags: iBeacons

Mobile Applications

Video Content

Bigdata & NoSQL

SaaS Applications



Alexa Certified Site Stats for