I'm trying to get the index (i.e. position of the word in the array) of a word in a 2D Array when a button is pressed. The word that I am looking for is the title of the button pressed.
@IBAction func buttonPressed(_ sender: UIButton) {
let buttonSelected = sender.currentTitle!
let findIndex = myArray.firstIndex(of: englishButtonSelected)!
}
when I build the code I get this error:
Cannot convert value of type 'String' to expected argument type '[String]'
The constant "buttonSelected" is a String.
I'm new to swift and still learning. Any help is much appreciated! Thank you!
Using Xcode 11.4