I am having a with graph, i need to remove duplicates values from array and "0" as well and i want to adjust array according to that for example
extension Array where Element: Equatable {
var unique: [Element] {
var uniqueValues: [Element] = []
forEach { item in
if !uniqueValues.contains(item) {
uniqueValues += [item]
}
}
return uniqueValues
}
}
let speed = [0, 10, 20, 20, 40, 50, 50 ,50, 80, 90, 100]
let time = ["9", "10", "11", "12", "13", "15", "16", "17", "18", "19", "20"]
speed.unique // Return Only Unique Values
Now i want my time array to be updated. Example Index : 0, 3 - is removed from speed i want to remove index 0, 3 from time as well
structwhere thestructhasspeedandtimeproperties. Then you much more easily sort and filter the array of struct. When done you could create the two final arrays from the final array ofstruct.