mnbayan / AutocompleteTextfieldSwift

Simple and straightforward sublass of UITextfield to manage string suggestions
MIT License
290 stars 66 forks source link

How to implement to other project? #25

Closed xuanzi23 closed 8 years ago

xuanzi23 commented 8 years ago
private func handleTextFieldInterfaces(){
    location.onTextChange = {[weak self] text in
        if !text.isEmpty{
            if let dataTask = self?.dataTask {
                dataTask.cancel()
            }
            self?.fetchAutocompletePlaces(text)
        }
    }

    location.onSelect = {[weak self] text, indexpath in
        Location.geocodeAddressString(text, completion: { (placemark, error) -> Void in
            if let coordinate = placemark?.location?.coordinate {
                self?.addAnnotation(coordinate, address: text)
                self?.mapkit.setCenterCoordinate(coordinate,  animated: true)
            }
        })
    }
}

i facing problem for on textchange

leandropjp commented 8 years ago

What you did to get it working in another project? I trying here but the autoCompleteString return nil

xuanzi23 commented 8 years ago

@leandropjp got any print screen?