Skip to content
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.

Commit

Permalink
Merge pull request #69 from hkellaway/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Harlan Kellaway committed Jul 5, 2015
2 parents 80a96c9 + 6d777ba commit 6bf1f76
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions README.md
Expand Up @@ -8,6 +8,8 @@

An Objective-C wrapper for the Google Places Autocomplete API

<img src="https://raw.githubusercontent.com/hkellaway/HNKGooglePlacesAutocomplete/master/example.png" title="demo" height="600" />

## Background

HNKGooglePlacesAutocomplete is an Objective-C wrapper for the Google Places Autocomplete API. It encapsulates the same core functionality as [SPGooglePlacesAutocomplete](https://github.com/spoletto/SPGooglePlacesAutocomplete) - autocomplete suggestions and Google Place-to-CLPlacemark translation - with the intention of modernizing the approach.
Expand Down Expand Up @@ -46,7 +48,7 @@ HNKGooglePlacesAutocomplete uses the [Google Places Autocomplete API](https://de
* Create a [Google Developer account](https://developers.google.com/)
* Create a new Project
* Turn on the Places API
* Find your API key on your Project's API Credentials
* Find your API key in your Project's API Credentials

### CoreLocation Framework

Expand All @@ -59,17 +61,17 @@ HNKGooglePlacesAutocomplete makes use of the `CoreLocation` framework. Make sure
These classes form the core functionality of HNKGooglePlacesAutocomplete

- `HNKGooglePlacesAutocompletePlaceQuery` - used to query the API for Place suggestions
- `HNKGooglePlacesAutocompletePlace` - Place object resulting from a Query
- `HNKGooglePlacesAutocompletePlace` - Place object returned from a Query

### Utilities

- `CLPlacemark+HNKAdditions.h` - provides translation from an `HNKGooglePlacesAutocompletePlace` to a `CLPlacemark`
- `CLPlacemark+HNKAdditions.h` - provides translation from `HNKGooglePlacesAutocompletePlace` to `CLPlacemark`

## Usage

### Setup

Requests cannot be made without first supplying `HNKGooglePlacesAutocomplete` with your Google Places API Key (see [API Key](#api-key)). Once your API key is obtained, you can setup `HNKGooglePlacesAutocomplete` for use by calling `setupSharedQueryWithAPIKey` on `HNKGooglePlacesAutocompleteQuery` (typically within the `AppDelegate`):
Requests cannot be made without first supplying `HNKGooglePlacesAutocomplete` with your Google Places API Key (see [API Key](#api-key)). Once your API key is obtained, you can setup `HNKGooglePlacesAutocomplete` for use by calling `setupSharedQueryWithAPIKey:` on `HNKGooglePlacesAutocompleteQuery` (typically within the `AppDelegate`):

#### `setupSharedQueryWithAPIKey:`

Expand All @@ -86,7 +88,7 @@ You should replace `YOUR_API_KEY` with your Google Places API key.
#### `fetchPlacesForSearchQuery:completion:`
```objective-c
[[HNKGooglePlacesAutocomplete sharedQuery] fetchPlacesForSearchQuery:@"Amoeba"
[[HNKGooglePlacesAutocompleteQuery sharedQuery] fetchPlacesForSearchQuery:@"Amoeba"
completion:^(NSArray *places, NSError *error) {
if (error) {
NSLog(@"ERROR: %@", error);
Expand Down Expand Up @@ -137,7 +139,7 @@ Errors returned by HNKGooglePlacesAutocomplete have a domain that starts with `c

A short description of the error can be found in the `error` object's `localizedDescription` property.

If the `error` has an underlying error, such as an error returned by `CLGeocoder`, it can be found in the `error` object's `userInfo` dictionary, under the `NSUnderlyingError` key.
If the `error` has an underlying error, such as an error returned by `CLGeocoder`, it can be found in the `error` object's `userInfo` dictionary, via the `NSUnderlyingError` key.

### Advanced Query Topics

Expand Down Expand Up @@ -222,7 +224,7 @@ For example, if a user typed "Amoeba" and a resulting Place suggestion had a `na

* `HNKGooglePlacesAutocompletePlaceTerm`

HNKGooglePlacesAutocompletePlace` objects have an array of `terms` that identify sections of the returned `name`.
`HNKGooglePlacesAutocompletePlace` objects have an array of `terms` that identify sections of the returned `name`.

For example, if a user types "Amoeba" and a resulting Place suggestion had a `name` of "Amoeba Music, Telegraph Avenue, Berkeley, CA, United States", the `terms` array would contain entries indicating that the `name` was composed of the terms "Amoeba Music", "Telegraph Avenue", "Berkeley", "CA", and "United States".

Expand Down

0 comments on commit 6bf1f76

Please sign in to comment.