mnbayan / AutocompleteTextfieldSwift

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

Tableview comes up but is blank #52

Closed jaymathew closed 7 years ago

jaymathew commented 7 years ago

I start typing and the tableview pops up like expected but it's blank. here are the func's I'm using swift 3 xcode 8 `

 func configureTextFields(){
    employeeNameTextField.autoCompleteTextColor = UIColor.black
    employeeNameTextField.autoCompleteTextFont = UIFont.systemFont(ofSize: 14.0)
    employeeNameTextField.autoCompleteCellHeight = 35.0
    employeeNameTextField.maximumAutoCompleteCount = 20
    employeeNameTextField.hidesWhenSelected = true
    employeeNameTextField.hidesWhenEmpty = true
    employeeNameTextField.enableAttributedText = true
    var attributes = [String:AnyObject]()
    attributes[NSForegroundColorAttributeName] = UIColor.black
    attributes[NSFontAttributeName] = UIFont(name: "HelveticaNeue-Bold", size: 12.0)
    employeeNameTextField.autoCompleteAttributes = attributes
}

func handleTextFieldInterfaces(){
    employeeNameTextField.onTextChange = {[weak self] text in
        if !text.isEmpty{
            self?.employeeNameTextField.autoCompleteStrings = ["jay", "jason", "josh", "john", "jill", "jimmy", "jim"]
        }
    }

    employeeNameTextField.onSelect = {[weak self] text, indexpath in
        print(text)
    }

}`

any thoughts?