测试已测试 | ✓ |
Lang语言 | SwiftSwift |
许可证 | MIT |
发布最新发布 | 2017年11月 |
SwiftSwift版本 | 4.0 |
SPM支持SPM | ✗ |
由Gonzalo Nunez维护。
Parrot是一个(非常)小的Swift框架,它可以帮助将iOS设备作为iBeacon进行广播,并能够监控/测量iBeacon的近距离。
Parrot允许您通过以下方式将设备转换为iBeacon:将您的设备转换为iBeacon
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)")
}
Parrot还允许您通过以下方式轻易地确定与iBeacon的邻近距离
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)")
}
)
Parrot可通过CocoaPods获取。要安装它,只需将以下行添加到您的Podfile中
pod "Parrot"
Parrot也可通过Carthage获取。将其添加到您的Cartfile中
github "carrot-ar/Parrot"
要查看我们如何使用Parrot,请查看carrot-ios!