Skip to content

aataraxiaa/BikeProvider

Repository files navigation

BikeProvider

CI Status Version License Platform

Description

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.

Requirements

Uses CoreLocation to retrieve location.

Installation

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

pod "BikeProvider"

Usage

  • Import the framework 'import SPBBikeProvider'
  • Make a request (nearest city, stations etc.) and consume the response

Simple as that

Examples

Location

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

...and in the location delegate...

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

Nearest city

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

Stations

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.

Sample app screenshot

Author

Pete Smith, peadar81@gmail.com

License

BikeProvider is available under the MIT license. See the LICENSE file for more info.

About

Tiny Swift provider for fetching city bike share information based on the citybik.es API

Resources

License

Stars

Watchers

Forks

Packages

No packages published