📜  来自原始值的枚举 swift 代码示例

📅  最后修改于: 2022-03-11 15:01:00.584000             🧑  作者: Mango

代码示例1
enum TestEnum: String {
  case Name = "Name"
  case Gender = "Gender"
  case Birth = "Birth Day"
}

let name = TestEnum(rawValue: "Name")!       //Name
let gender = TestEnum(rawValue: "Gender")!   //Gender
let birth = TestEnum(rawValue: "Birth Day")! //Birth