I am relatively new to swift and programming languages of its kind, and I have really been struggling with having a textfield look for ALL values individually in a string array. So here's my code:
var greetingArray = ["Hi", "hi", "hello", "Hello", "hey", "Hey", "sup", "Sup", "What's up", "what's up"]
Above is the array, and below is the textfield's action.
@IBAction func textUltraAction(textout: UITextField) {
}
If the "textout.text" is any one of the greetings in greetingArray (but not all of them collectively), I want to complete the action. For example, if "sup" or "hi" is inputed in the textfield, i want to complete the action. I do not want to manually have to type out:
greetinArray[0], greetinArray[1], greetinArray[2], etc...
Thanks in advance for any help anyone can give me!
Try this:
Hope this helps.. :)