[![CI Status](http://img.shields.io/travis/Hozefa Indorewala/HIPlaces.svg?style=flat)](https://travis-ci.org/Hozefa Indorewala/HIPlaces)
An Objective - C wrapper for the Google Places API. The library currently includes
You will need a valid Google API key which you can obtain from the Google Developers Console. Once you have a key, replace the "YOUR_KEY_HERE" string in HIPlaceAutocompleteViewController.m & HIPlaceDetailsTableViewController.m with your Google API key.
To run the HIPlacesExample project, clone the repo, and run pod install
from the HIPlaces directory first. Don't forget to replace the "YOUR_KEY_HERE" string in HIPlaceAutocompleteViewController.m & HIPlaceDetailsTableViewController.m with your Google API key. If you don't have one then obtain one from the Google Developers Console.
|
|
#import <HIPlaces/HIPlaces.h>
HIPlacesManager *_placesManager = [[HIPlacesManager alloc] init];
_placesManager.delegate = self;
HIPlaceAutocompleteRequest *placeAutocompleteRequest = [[HIPlaceAutocompleteRequest alloc] init];
placeAutocompleteRequest.key = @"YOUR_KEY_HERE";
placeAutocompleteRequest.input = @"Paris";
[_placesManager searchForPlaceAutocompleteResultsWithRequest:placeAutocompleteRequest];
HIPlaceDetailsRequest *placeDetailsRequest = [[HIPlaceDetailsRequest alloc] init];
placeDetailsRequest.key = @"YOUR_KEY_HERE";
placeDetailsRequest.placeId = @"ChIJD7fiBh9u5kcRYJSMaMOCCwQ";
[_placesManager searchForPlaceDetailsResultWithRequest:placeDetailsRequest];
- (void)placesManager:(HIPlacesManager *)placesManager didSearchForPlaceAutocompleteResults:(NSArray *)placeAutocompleteResults
{
# Do stuff with placeAutocompleteResults
}
- (void)placesManager:(HIPlacesManager *)placesManager searchForPlaceAutocompleteResultsDidFailWithError:(NSError *)error
{
# Handle error
}
- (void)placesManager:(HIPlacesManager *)placesManager didSearchForPlaceDetailsResult:(HIPlaceDetailsResult *)placeDetailsResult
{
# Do stuff with placeDetailsResult
}
- (void)placesManager:(HIPlacesManager *)placesManager searchForPlaceDetailsResultDidFailWithError:(NSError *)error
{
# Handle error
}
HIPlaces is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "HIPlaces"
Hozefa Indorewala, [email protected]
HIPlaces is available under the MIT license. See the LICENSE file for more info.