ComputedBGTargets+Getter.swift 510 B

123456789101112
  1. // import Foundation
  2. //
  3. // extension ComputedBGTargets {
  4. // func targetEntry(for time: Date = Date()) -> ComputedBGTargetEntry? {
  5. // // Assumes targets are sorted by start/offset ascending, wrap at midnight
  6. // let nowMinutes = Calendar.current.component(.hour, from: time) * 60 +
  7. // Calendar.current.component(.minute, from: time)
  8. // // Find last entry with offset <= nowMinutes
  9. // return targets.last(where: { $0.offset <= nowMinutes }) ?? targets.first
  10. // }
  11. // }