iOS - Subclass of UITextField to achieve autocompletion for Place Search like Google Places, Uber and Much more apps having maps.

Overview

MVAutocompletePlaceSearchTextField

iOS - Subclass of UITextField to achieve autocompletion for Place Search like Google Places, Uber and Much more apps having maps.

MVAutocompletePlaceSearchTextField is an extension (in actual case,Subclass) of a very popular Automcomplete Textfield class MLPAutoCompleteTextField.

MVAutocompletePlaceSearchTextField is Drop-in Solution to achieve functionalities like Autpcomplete Search with Drop-down list of all suggestions related to Textual Query entered by user.(Like Google Maps, Uber, etc.)

Storyboard support it there, so user have to just Give classname to any UITextField and Bind its 'PlaceSearchTextFieldDelegate' to Delegate class.

With very simple Delegate methods developer can easily integrate and exploit This control.

Requirement

Developer has to get an API Key from Google Api console for Google Places API Web Service.

EDIT: As per the latest updates, You will need to integrate GoogleMaps SDK. For that you may head out to Google iOS SDK Integration (Step 3)

How to Use?

  • Bind 'MVPlaceSearchTextField' as Class for UITextField in the Storyboard.
  • Also set its delegate named, placeSearchDelegate.
  • And set your API Key as value of Property "strApiKey" Create iOS Key to use it here from Google Console, for more info
  • Also add [GMSServices provideAPIKey:@"YOUR API KEY"]; in application:didFinishLaunchingWithOptions of AppDelegate.

or refer Step 4 from https://developers.google.com/places/ios-api/start#get-key

That's it !!

Animated Demo

Updated with New GoogleMaps SDK for iOS

Control is now updated to use with iOS API Keys (Earlier it was using NSURLConnection along with Browser key from Google APIs).Its now fully supported with Google's standard classes like GMSPlace, so that it can be easily used along with Google Maps

Special Thanks

https://github.com/EddyBorja/MLPAutoCompleteTextField

Comments
  • Added my API key but nothing is returned

    Added my API key but nothing is returned

    Just for test purposes, i have used your example project, added my API key and added your bundle identifier in my Google Console, but i am still returning nothing. Does anyone know how long it takes an API Key to become usable? It seems to indicate right away but i'm not returning anything. Sorry for the probably dumb question but its got me perplexed.

    opened by daddymac72 5
  • How to set locality?

    How to set locality?

    When I use this text field for searching, it doesn't start searching from the nearest location. How do I make it search for locally significant places first?

    opened by frakman1 4
  • Swift usage can't conform to protocol

    Swift usage can't conform to protocol

    Hi,

    This is fantastic. I'm implementing this wrapper into my swift code. I have followed all the instructions. I subclasses a textfield with MVPlaceSearchTextField, created the outlet. Then I attached the delegate PlaceSearchTextFieldDelegate to the view controller. Next I set the strapi key.

    But once I try setting the delegate methods (four of them). I still get the can't conform error.

    Here is my extension of my AddAddressViewController class which is subclass of UIViewController. I have everything, but I seem to be missing something, clearly.

    extension AddAddressViewController: PlaceSearchTextFieldDelegate {

    //MARK: Placesearch Textfield Delegates
    
    func placeSearch(textField: MVPlaceSearchTextField!, responseForSelectedPlace responseDict: GMSPlace!) {
        return
    }
    
    func placeSearch(textField: MVPlaceSearchTextField!, resultCell cell: UITableViewCell!, withPlaceObject placeObject: PlaceObject!, atIndex index: Int) {
    }
    
    func placeSearchWillHideResult(textField: MVPlaceSearchTextField!) {
    }
    
    func placeSearchWillShowResult(textField: MVPlaceSearchTextField!) {
    }
    

    }

    opened by petergzli 2
  • autocomplete does not recognize spaces

    autocomplete does not recognize spaces

    when typing a place with a space, the auto complete does not recognize it. For example Los Angeles. If you type Los .... then a space, Los Angeles does not come up. But if you type LosAngeles it comes up but with space.

    Can you add the recognizing of spaces? Then it seems to work very well.

    opened by daddymac72 2
  • GMSPlace.h expected a type in MLPAutoCompleteTextField.h

    GMSPlace.h expected a type in MLPAutoCompleteTextField.h

    I am getting this error "expected a type" on this line of code -(void)placeSearch:(MVPlaceSearchTextField*)textField ResponseForSelectedPlace:(GMSPlace*)responseDict; in MLPAutoCompleteTextField.h class. I have added all the files but still unable to resolve this error

    opened by unoiatech 1
  • implementation at swift

    implementation at swift

    Hi, i am new in github. I searching the auto complete place search for text field but my project is write in swift. So how to implement ur project into mine swift project?

    opened by xuanzi23 1
  • Multiple MVPlaceSearchTextField?

    Multiple MVPlaceSearchTextField?

    How to handle if i have multiple MVPlaceSearchTextField? (i have "From Address and To Address")

    '-(void)placeSearchResponseForSelectedPlace:(GMSPlace*)responseDict' doesn't say to which text box does responseDict belongs to.

    opened by aaru 1
  • Feature requests

    Feature requests

    Hello, a couple nice features would be:

    1. switches to turn on and off types of locations in response (e.g. natural feature, amusement park, point of interest, etc) so that it only returns cities if you want.
    2. Save to NSDefaults the returned name and coordinates.
    opened by daddymac72 1
  • when i select a cell from autosuggested list the tap is not happening , but on long tap of that cell it works regular can you please help it

    when i select a cell from autosuggested list the tap is not happening , but on long tap of that cell it works regular can you please help it

    Some times single tap is working and sometimes we need to hold the cell for 3-4 seconds.... Above line variation is happening based on build.. In a view i have many child objects but the first child is textfield.

    opened by amirtatx 1
  • how to increase number of row and search in radius around 500.

    how to increase number of row and search in radius around 500.

    As always there is 5 umber of row. it's by default.

    i have changed _tfStreetName.maximumNumberOfAutoCompleteRows = 10; but no use of it.

    and how to search by location. the area which come nearer. it come in first row

    opened by MadBurea 1
  • Search Only Cities and Location within radius 500

    Search Only Cities and Location within radius 500

    Thanks for sharing awesome wrapper class, need help for search in textfield 1 with only cities and in next textfield 2, need to search within that selected city, locations I have google API's which can be used, don't know how to use in these classes

    search only cities api https://maps.googleapis.com/maps/api/place/autocomplete/json?key=&types=(cities)&input=ba

    searching location within radius 500 https://maps.googleapis.com/maps/api/place/autocomplete/json?key=&location=12.9715987,77.5945627&radius=500&input=k

    opened by ghousesgb 0
  • App crashing when start typing in text filed

    App crashing when start typing in text filed

    Whenever I start typing in textfield which is subclass of MVPlaceSearchTextField my app crashes with error

    [NSTaggedPointerString asciiLevenshteinDistanceWithString:]: unrecognized selector sent to instance I tried to google the issue. But couldn't find any solution. Can you please help me resolving this ? I have no clue what is asciiLevenshteinDistanceWithString and how to debug the issue.

    opened by unoiatech 0
Owner
Mrugrajsinh Vansadia
Results-driven mobile software architect and developer specializing in Objective-C and Swift programming on the iOS platform. Passionate about creating great us
Mrugrajsinh Vansadia
Animated Subclass of UITextField created with CABasicAnimation and CAShapeLayer

JDAnimatedTextField JDAnimatedTextField is animateable UITextField that can significantly enhance your user's experiences and set your app apart from

Jawad Ali 25 Dec 13, 2022
UITextfield subclass with autocomplete menu. For iOS.

MLPAutoCompleteTextField "We believe that every tap a user makes drains a tiny bit of their energy and patience. Typing is one of the biggest expendit

Eddy Borja 1.2k Nov 11, 2022
An UITextField subclass to simplify country code's picking. Swift 5.0

Preview Installation NKVPhonePicker is available through CocoaPods. To install it, simply add the following line to your Podfile: pod 'NKVPhonePicker'

Nike Kov 140 Nov 23, 2022
UITextField subclass with floating labels

JVFloatLabeledTextField JVFloatLabeledTextField is the first implementation of a UX pattern that has come to be known the "Float Label Pattern". Due t

Jared Verdi 7.2k Jan 2, 2023
Subclass of UITextField that shows inline suggestions while typing.

AutocompleteField Subclass of UITextField that shows inline suggestions while typing. Plug and play replacement for UITextField. Delimiter support. Pe

Filip Stefansson 663 Dec 6, 2022
TTextField is developed to help developers can initiate a fully standard textfield including title, placeholder and error message in fast and convinient way without having to write many lines of codes

TTextField is developed to help developers can initiate a fully standard textfield including title, placeholder and error message in fast and convinient way without having to write many lines of codes

Nguyen Duc Thinh 7 Aug 28, 2022
This is the demo repository for having floating TextField in swift UI

ed-floating-field-swiftui This is the demo repository for having floating TextField in swift UI The inputs fields should not be empty Validations for

Patrick 1 May 26, 2022
Animated UITextField and UITextView replacement for iOS

AnimatedTextInput iOS custom text input component used in the Jobandtalent app. Installation Use cocoapods to install this custom control in your proj

jobandtalent 757 Dec 15, 2022
🏄‍♂️ UITextField-Navigation makes it easier to navigate between UITextFields and UITextViews

' __________________ _______ _________ _______ _________ _______ _ ______ ' |\ /|\__ __/\__ __/( ____ \|\ /

Thanh Pham 446 Nov 24, 2022
This project will add a done button on your UITextField and UITextView

This project will add a done button on your UITextField and UITextView

Botla Venkatesh 0 Nov 23, 2021
UITextField with underline and left image

TJTextField UITextField with underline and left image Version: 1.0 Features Add image in UITextField Left text pedding Underline whole UITextField Sho

Tejas Ardeshna 44 May 16, 2022
UITextField and UITextView subclasses with placeholders that change into floating labels when the fields are populated with text.

Deprecated Please use JVFloatLabeledTextField instead or feel free to chime in on an issue if you'd like to take over the repo. RPFloatingPlaceholders

rob phillips 1.1k Jan 5, 2023
HTYTextField A UITextField with bouncy placeholder.

HTYTextField - A UITextField with bouncy placeholder. Screenshot Installation CocoaPods Add the dependency to your Podfile

Hanton Yang 312 Nov 13, 2022
Fully-wrapped UITextField made to work entirely in SwiftUI

iTextField ⌨️ A fully-wrapped `UITextField` that works entirely in SwiftUI. ?? Get Started | Examples | Customize | Install | Get Started Install iTex

Benjamin Sage 89 Jan 2, 2023
UITextField character counter with lovable UX 💖. No math skills required 🙃.

TextFieldCounter UITextField character counter with lovable UX ??. No math skills required ??. Features Set max length of UITextField. A beautiful an

Fabricio Serralvo 434 Dec 22, 2022
Animated UITextField enhance UX for the user by giving clarity that they are focused

JDCircularProgress JDTextField is animateable UITextField that can significantly enhance your user's experiences and set your app apart from the rest

Jawad Ali 22 Nov 17, 2022
UITextField category that adds shake animation

UITextField category that adds a shake animation like the password field of the OsX login screen. Screenshot Setup with CocoaPods pod 'UITextField+Sha

Andrea Mazzini 749 Dec 13, 2022
UITextField extension in Swift that adds shake animation

UITextField-Shake-Swift UITextField extension in Swift that adds shake animation Initially created by Andrea Mazzini (using Objective-C) on 08/02/14:

null 15 Jul 20, 2021
UITextField that automatically formats text to display in the currency format

CurrencyTextField The numbers that the user enters in the field are automatically formatted to display in the dollar amount format. For example, if th

Richa Deshmukh 49 Sep 28, 2022