I have a UIPickerView that loads data to an array - it's working, but then I have the same UIPickerView on another page that I want to display data that is saved when I select an item. This works, if the data exists in the array. If the data dose not exist an index out of range error occurs, and the app crashes.
if data[indexRow].isEmpty
{
distanceLabel.text = ""//works
}else if (){//need this code
print("data")
}else print("data")//need this code
What I need is, how can I test if the value dose not exists (has not been entered on the previous page) in the array without crashing the app.
if indexRow < data.count { // do something element exists at index