How to bring array object to first Index
struct ScheduleDateTime {
var startDate: String?
var endDate: String?
var isScheduled: Bool?
}
var scheduleDateTime = [ScheduleDateTime]()
func reArrange(){
if let scheduleList = scheduleDateTime{
if scheduleList.count > 1 {
for each in scheduleList {
if each.isScheduled == true {
// Bring the item to first Index.
}
}
}
}
}
How to bring the array Index to first position based on above isSchedule == true condition