Swift Uzyskaj wszystkie przypadki zaczynające się od
// Swift 5
public enum WeekDay: Int, CaseIterable {
case sunday = 1, monday, tuesday, wednesday, thursday, friday, saturday
static public func allCasesStartingWith(_ startWeekday: WeekDay) -> [WeekDay] {
guard let startIndex = WeekDay.allCases.firstIndex(of: startWeekday) else {
return WeekDay.allCases
}
let firstPart = Array(WeekDay.allCases.suffix(from: startIndex))
let lastPart = Array(WeekDay.allCases.prefix(upTo: startIndex))
}
}
Rens