Change trending category button behavior

This commit is contained in:
Arkadiusz Fal
2021-06-25 00:48:28 +02:00
parent 0e02a6e25a
commit 594c77b7d4
6 changed files with 49 additions and 19 deletions

View File

@@ -0,0 +1,8 @@
extension CaseIterable where Self: Equatable {
func next() -> Self {
let all = Self.allCases
let idx = all.firstIndex(of: self)!
let next = all.index(after: idx)
return all[next == all.endIndex ? all.startIndex : next]
}
}