Ambiguous reference to member 'subscript' when converting to Swift 3

时间:2017-04-10 03:06:17

标签: swift xcode

Upon converting a project to Swift 3, accessing "locationArray[i]" gives me the error "Ambiguous reference to member 'subscript'". Any help would be appreciated.

var locationArray: [(textField: UITextField?, mapItem: MKMapItem?)]!


func showRoute(_ routes: [MKRoute], time: TimeInterval) {
    var directionsArray = [(startingAddress: String, endingAddress: String, route: MKRoute)]()
    for i in 0..<routes.count {
        plotPolyline(routes[i])
        directionsArray += [(locationArray[i].textField?.text!,
                             endAddress: locationArray[i+1].textField?.text!, route: routes[i])]
    }
    displayDirections(directionsArray)
    printTimeToLabel(time)
}

0 个答案:

没有答案