BikeProvider 4.3

BikeProvider 4.3

测试已测试
Lang语言 SwiftSwift
许可证 MIT
发布最后发布2018年10月
SPM支持SPM

Pete Smith维护。



BikeProvider

CI Status Version License Platform

描述

BikeProvider 是一个用于检索相关城市共享自行车信息的迷你、方便的库。基于用户的位置,它使用 citybik.es API 来查找可用的最近城市。然后,它可以返回相关的自行车站信息,例如站点的位置和可用自行车的数量等。

该框架是为了适应Bikey而构建的,这是一个可在 App Store 上使用的免费共享自行车应用程序。

要求

使用 CoreLocation 来获取位置。

安装

BikeProvider 可通过 CocoaPods 使用。要安装它,只需将以下行添加到 Podfile 中

pod "BikeProvider"

使用方法

  • 导入框架 'import SPBBikeProvider'
  • 发送请求(最近的城镇、站点等)并消费响应

很简单

示例

位置

LocationProvider.sharedInstance.delegate = self
LocationProvider.sharedInstance.getLocation(withAuthScope: .authorizedWhenInUse)

...并在位置代理中...

func retrieved(location: CLLocation) {
  // Do something with the location here
}

最近的城镇

CityProvider.city(near: location, onSuccess: { city in
  // Do something with the city here
}, onFailure: {
  // Oh no, something went wrong
})

站点

StationProvider.stations(fromCityURL: city.url, onSuccess: { stations in
  // Do something with the stations here
}, onFailure: {
  // Oh no, something went wrong
})

详见示例项目以获取更详细的示例。

Sample app screenshot

作者

Pete Smith, [email protected]

许可证

BikeProvider遵循MIT许可证。有关更多信息,请参阅LICENSE文件。