TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Sep 2015 |
SPMSupports SPM | ✗ |
Maintained by Tanner Nelson.
To run the example project, clone the repo, and run pod install
from the Example directory first.
To fetch nearby Eddystone objects, simply start the scanner
Eddystone.Scanner.start(self)
Then get an array of the nearby objects
Eddystone.Scanner.nearby
To start the scanner, you will need to provide an Eddystone.ScannerDelegate
delegate that will be notified to changes in the nearby objects
public protocol ScannerDelegate {
func eddystoneNearbyDidChange()
}
Objects of the Eddystone.Generic
class returned by Eddystone.Scanner.nearby
have several properties gathered from the three Eddystone frame types and basic beacon information.
public var signalStrength: Beacon.SignalStrength
public var identifier: String
public var url: NSURL?
public var namespace: String?
public var instance: String?
public var uid: String?
public var battery: Double?
public var temperature: Double?
public var advertisementCount: Int?
public var onTime: NSTimeInterval?
Since Eddystone beacons may broadcast one or more of the frame types, most of the properties on the Eddystone.Generic
class are optionals. If your application is dealing exlusively with Eddystone-URL or Eddystone-UID frame types, you may use the following Eddystone.Scanner
properties instead.
Notice the objects returned by these methods have properties that are not optionals.
Get an array of Eddystone.Url
objects with
Eddystone.Scanner.nearbyUrls
Eddystone.Url
objects have the following properties
public var signalStrength: Beacon.SignalStrength
public var identifier: String
public var url: NSURL
Get an array of Eddystone.Uid
objects with
Eddystone.Scanner.nearbyUids
Eddystone.Uid
objects have the following properties
public var signalStrength: Beacon.SignalStrength
public var identifier: String
public var namespace: String
public var instance: String
public var uid: String
Logs from the Eddystone module may be helpful while debugging your application. To enable logs, use the following line.
Eddystone.logging = true
As Eddystone beacons become closer or farther away from the device, they will need to be re-arranged on screen. The following gist makes re-arranging the data source for your UITableView
much easier.
ExampleViewController: UIViewController, Eddystone.ScannerDelegate {
var urls = Eddystone.Scanner.nearbyUrls
var previousUrls: [Eddystone.Url] = []
func eddystoneNearbyDidChange() {
self.previousUrls = self.urls
self.urls = Eddystone.Scanner.nearbyUrls
self.mainTableView.switchDataSourceFrom(self.previousUrls, to: self.urls, withAnimation: .Top)
}
}
https://gist.github.com/tannernelson/6d140c5ce2a701e4b710
Showing the relative signal strength for an Eddystone object helps the user understand how close they are to the beacon. This cocoapod provides you with an iOS 7 style Signal Strength view that you can put anywhere in your application.
https://cocoapods.org/pods/SignalStrength
Eddystone uses CoreBluetooth
Eddystone is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "Eddystone"
The Eddystone cocoapod comes with an example iOS project that shows how the various method calls work in a real application. The example application also includes the aforementioned Additional Resources.
Tanner Nelson, [email protected]
Eddystone is available under the MIT license. See the LICENSE file for more info.