mirror of
https://github.com/whoeevee/EeveeSpotifyReborn.git
synced 2026-01-09 00:23:20 +01:00
10 lines
324 B
Swift
10 lines
324 B
Swift
import Foundation
|
|
|
|
extension Collection {
|
|
func dropLast(while predicate: (Element) throws -> Bool) rethrows -> SubSequence {
|
|
guard let index = try indices.reversed().first(where: { try !predicate(self[$0]) }) else {
|
|
return self[startIndex..<startIndex]
|
|
}
|
|
return self[...index]
|
|
}
|
|
} |