GithubHelp home page GithubHelp logo

googleplacessearchcontroller's Introduction

GooglePlacesSearchController

Version License Platform

A simple Google Places API autocompleting address search controller (subclass of UISearchController) for iOS devices.

GooglePlacesSearchController is 100% Swift 4, and is a fork of GooglePlacesAutocomplete.

No attempt has been made to integrate MapKit since displaying Google Places on a non-Google map is against their terms of service.


Screenshots


Requirements

iOS 8.0+ Xcode 8.0+ / Swift 4.0

Installation

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

pod 'GooglePlacesSearchController'

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

To integrate GooglePlacesSearchController in your code the simplest way would be:

let controller = GooglePlacesSearchController(delegate: self,
                                              apiKey: GoogleMapsAPIServerKey,
                                              placeType: .address
    // Optional: coordinate: CLLocationCoordinate2D(latitude: 55.751244, longitude: 37.618423),
    // Optional: radius: 10,
    // Optional: strictBounds: true,
    // Optional: searchBarPlaceholder: "Start typing..."
)

And then add controller's searchbar controller.searchBar to your view.

To get selected place use viewController(didAutocompleteWith:) delegate method:

extension ViewController: GooglePlacesAutocompleteViewControllerDelegate {
    func viewController(didAutocompleteWith place: PlaceDetails) {
        print(place.description)
        placesSearchController.isActive = false
    }
}

Author

Dmitry Shmidt with help of other contributors.

License

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

googleplacessearchcontroller's People

Contributors

basememara avatar caotrido avatar ealeksandrov avatar jdanthinne avatar pahmed avatar readmecritic avatar ricsantos avatar shmidt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

googleplacessearchcontroller's Issues

API key not working

I keep getting GooglePlaces API Error: REQUEST_DENIED in the debugger why is tat? Which API key should I use?

Extra space in tableview

Hey,
I run your example but in the search view, there is extra space above the tableview. See first cell.

simulator screen shot - iphone 8 - 2018-06-05 at 15 22 37

Error on search view

I am getting this error - fatal error: unexpectedly found nil while unwrapping an Optional value.

when I want to search something then getting this error. how to fix it?

need post code in search result

need to display with post code in search list ?
Screenshot 2020-10-09 at 11 38 50 PM

using regions but not getting post code

lazy var placesSearchController: GooglePlacesSearchController = {
        let controller = GooglePlacesSearchController(delegate: self,
                                                      apiKey: GoogleMapsAPIServerKey,
                                                      placeType: .regions,

            
        )
        return controller
    }()

thank you

Allow the user to enter text that doesn't match a result

As per the Google Calendar app on iOS, if the user types in, say "Bob's House", and there isn't a relevant result, the user can press Done on the keyboard and that text based result will be used.

Update the keyboard return key type and delegate to handle a manual string result.

Powered by Google not showing

The Library is working without any problem, Awesome Library it is. Nice work Done.
I need Powered by Google Logo as the Footer for TableView.

I tried to access any of the property which is related to the tableView in My own ViewController. [Couldn't access any of it].

Then I tried messing up with the code in the File GooglePlacesSearchController.swift
but couldn't see any success.

Though there is a png file in Resources folder, already there "[email protected]" but how to use it like the screenshot you posted in the Readme of the Library .??

Thanks in advance.

Version 0.2.2 not in CocoaPods

It looks like the version 0.2.2 is not pushed to CocoaPods. I'm getting error when trying to install version 0.2.2.

My pod file looks like,
pod 'GooglePlacesSearchController', '0.2.2'

My error looks like,

[!] CocoaPods could not find compatible versions for pod "GooglePlacesSearchController":
  In Podfile:
    GooglePlacesSearchController (= 0.2.2)

None of your spec sources contain a spec satisfying the dependency: `GooglePlacesSearchController (= 0.2.2)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

I tried doing pod repo update but no luck.

Search bar Position

Hey,
In my project, i have to show search bar below to the navigation bar. How can i modify this. Please suggest.

Thanks!!

Debounce the search field input or use sessions

If the user is typing quickly, multiple requests are made to the /place/autocomplete endpoint. As Google charges per request, might be good to debounce or filter the keyboard input so that requests are made as soon as the user stops typing.

Alternatively, looking at the pricing page https://developers.google.com/places/web-service/usage-and-billing, it appears that a session can be used such that the /autocomplete request is free, and only the /details request is billed.

Adding within view is jumping when searching the place

I have added searchcontroller to view but when i search it changes its position and after completing search it backs to original position.

    self.view.addSubview((placesSearchController.searchBar))

Please check attached screenshot for reference

Simulator Screen Shot - iPhone 11 Pro Max - 2020-04-27 at 21 04 57
Simulator Screen Shot - iPhone 11 Pro Max - 2020-04-27 at 21 04 59

Add filter in GooglePlacesSearchController

How can I add a search Filter like this

 // Specify a filter.
        let filter = GMSAutocompleteFilter()
        filter.type = .address
        filter.country = "IN"
        autocompleteController.autocompleteFilter = filter

in GooglePlacesSearchController Please suggest?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.