【发布时间】:2021-12-15 09:52:36
【问题描述】:
如何将数组对象带到第一个索引
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.
}
}
}
}
}
如何根据上述isSchedule == true 条件将数组索引置于首位
【问题讨论】:
-
for 0..