BikeProvider is a tiny, convenient library for retrieving relevant city bike share information. Based on the user's location, it uses the citybik.es API to to find the nearest city with bike share availability. It can then return relevant bike station information such as station location and number of available bikes etc.
The framework was built to accommodate Bikey, my free bike share app available on the app store.
Uses CoreLocation to retrieve location.
BikeProvider is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "BikeProvider"
- Import the framework 'import SPBBikeProvider'
- Make a request (nearest city, stations etc.) and consume the response
Simple as that
LocationProvider.sharedInstance.delegate = self
LocationProvider.sharedInstance.getLocation(withAuthScope: .authorizedWhenInUse)
...and in the location delegate...
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
})
See the sample project for fuller examples.
Pete Smith, peadar81@gmail.com
BikeProvider is available under the MIT license. See the LICENSE file for more info.