If your array elements are objects and you want to find an identical object in that array, you can use this function:
func findObject(domain: C, value: C.Generator.Element) -> Int? {
for (index, element) in enumerate(domain) {
if element === value {
return index
}
}
return nil
}