I was looking for a way to write this code shorter and still get the same result. Can this be achieved?
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 0 {
print("connection status pressed")
print("get")
let connectionStatusSelectorViewController = ConnectionStatusSelector()
//profileEditor.user = self.user
navigationController?.pushViewController(connectionStatusSelectorViewController, animated: true)
}else{
if indexPath.row == 1 {
print("account type pressed")
let AccountSelectorViewController = AccountTypeSelector()
navigationController?.pushViewController(AccountSelectorViewController, animated: true)
}else{
if indexPath.row == 2 {
print("gender type pressed")
let GenderSelectorViewController = GenderTypeSelector()
navigationController?.pushViewController(GenderSelectorViewController, animated: true)
}else{
if indexPath.row == 3 {
print("service type pressed")
let serviceSelectorViewController = ServiceTypeSelector()
navigationController?.pushViewController(serviceSelectorViewController, animated: true)
}else{
if indexPath.row == 4 {
print("distance pressed")
}else{
print("nothing")
}
}
}
}
}
}