Skip to content

carrot-ar/parrot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

48 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Carrot

Parrot is a Swift framework for advertising an iOS device as an iBeacon and monitoring/ranging other iBeacons.

๐ŸŽ™ Broadcasting an iBeacon Signal

Parrot allows you to turn your device into an iBeacon by doing the following:

let uuid = UUID(string: "E621E1F8-C36C-495A-93FC-0C247A3E6E5F")!
let beaconAdvertiser = BeaconAdvertiser(uuid: uuid, identifier: "com.myCompany.BeaconIdentifier", params: .none)
beaconAdvertiser.startAdvertising { advertiser, state in 
  print("State: \(state) for \(advertiser)")
}

๐Ÿ”Š Determining the Proximity to an iBeacon

Parrot also allows you to very easily determine the proximity to an iBeacon by doing the following:

let uuid = UUID(string: "E621E1F8-C36C-495A-93FC-0C247A3E6E5F")!
let beaconMonitor = BeaconMonitor(uuid: uuid, identifier: "com.myCompany.BeaconIdentifier", params: .none)
beaconMonitor.startMonitoring(
  onProximityUpdate: { monitor, proximity in
    print("Proximity: \(proximity) for \(monitor)")
  },
  onError: { error in
    print("Error occured: \(error)")       
  }
)

๐Ÿ“š Example

To run the example project, clone the repo and run pod install from the Example directory first. If you'd like to advertise and monitor, you'll need two devices.

๐Ÿ›  Installation

Parrot is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "Parrot"

Parrot is also available through Carthage. Add this to your Cartfile:

github "carrot-ar/Parrot"

About

๐Ÿฆ Swift framework for advertising an iOS device as an iBeacon and monitoring/ranging other iBeacons

Resources

License

Stars

Watchers

Forks

Packages

No packages published