I have created an Array with two Strings:
var palabras: [String] = ["Gato", "Martillo"]
And I want to show the first character of this two String of the Array.
I have tried with:
letraLabel.text = palabras[round - 1].startIndex.advancedBy(0)
But i get an error: Command failed due to signal: Segmentation fault: 11 I don't know what it is mean.
And i have tried too:
letraLabel.text = palabras[round - 1].startIndex
I get an error: Cannot assign value of type 'Index' (aka 'String.CharacterView.Index') to type 'String?'
And finally I have tried:
letraLabel.text = palabras[round - 1][palabras.startIndex]
But also I got an error: 'subscript' is unavailable: cannot subscript String with an Int, see the documentation comment for discussion
How can I get the first character of the two word of the Array? So, is necessary import Foundation for obtain the first character of a String? By the way, when i write "import Foundation" the compiller show me Foundation with a crossed-out line.