SwiftUI 中CaseIterable的作用?
Code
enum Week: CaseIterable { case Sun case Mon case Tue case Wen case Thu case Fri case Sat } print(Week.allCases) //也可以重写allCases方法 enum Week2: CaseIterable { case Sun case Mon case Tue case Wen case Thu case Fri case Sat static var allCases: [Week2]{ return [.Mon, .Tue, .Wen, .Thu, .Fri, Sat, Sun] } } print(Week2.allCases)
此文仅为鄙人学习笔记之用,朋友你来了,如有不明白或者建议又或者想给我指点一二,请私信我。liuw_flexi@163.com/QQ群:582039935.
我的gitHub: (学习代码都在gitHub)
https://github.com/nwgdegitHub/