Inline suggestions aren't visible when searchTextField is first responder
After calling becomeFirstResponder(), suggestions won't appear when inlineMode is true. I've reproduced the problem below:
IBOutlet weak var textField: SearchTextField!
override func viewDidLoad() {
super.viewDidLoad()
var suggestions: [String] = ["one", "two", "three", "four", "five", "six"]
textField.delegate = self
textField.filterStrings(suggestions)
textField.inlineMode = true
textField.becomeFirstResponder()
}
Is there a fix for this that I'm unaware of?
"inlineMode" implies a text field that starts suggesting an option as soon as you start typing. Is there any chance that you confused the feature?.
Unless this bug is considered a feature then no I'm not confused.
Expected behavior: As soon as the scene comes into view the text field comes into focus (i.e. the cursor appears) and the keyboard is displayed. When the user begins typing, suggestions should appear as a placeholder in the text field. When the user hits enter/done, the text autocompletes.
Current behavior: The cursor and keyboard are displayed but the placeholder is not visible. However, if the user hits enter the word will still autocomplete to the expected suggestion.
My bad, you are totally right, it's a bug.
Since I can't reproduce it, can you please help me checking that it's related to this another bug?: https://github.com/apasccon/SearchTextField/issues/82
Thanks.
It definitely seems related. I reproduced #82 and got the same results, however once you add emailInlineTextField.becomeFirstResponder() no suggestions are visible but the autocomplete result is still being set to the text field's label (according to the view hierarchy).
I tested this with and without a placeholder, with and without the emailInLineTextField being the first responder, and a combination of each. The only instance where the suggestions are displayed onscreen is when a placeholder is set and the text field is NOT the first responder. Other than that there appears to be no differences in the UILabel's properties.