.next() enum swift code example
Example: .next() enum swift
enum Fruits: CaseIterable {
case apple, banana, pitahaya, cherry
mutating func loopme() {
let a = Self.allCases
self = a[(a.firstIndex(of: self)! + 1) % a.count]
}
}