I am trying to find the first repeating character in swift, and returning the character found. I am getting a bunch of errors with this code, I am not sure why this is not working.
var myArry = "Hello, World"
var counts = [Character]()
func findRepeating(myArry: String) -> Character
{
counts = []
for char in myArry.characters
{
if char in counts
{
print("Character found")
return char
}
else
{
counts.append(char)
}
}
return "A"
}