rawValue 用于swift中的enum(枚举),用于取枚举项的原始值,例如:
enum Category: String, CaseIterable, Codable, Hashable {
case featured = "Featured"
case lakes = "Lakes"
case rivers = "Rivers"
case mountains = "Mountains"
}
Category.lakes.rawValue 就是 "Lakes"
rawValue 用于swift中的enum(枚举),用于取枚举项的原始值,例如:
enum Category: String, CaseIterable, Codable, Hashable {
case featured = "Featured"
case lakes = "Lakes"
case rivers = "Rivers"
case mountains = "Mountains"
}
Category.lakes.rawValue 就是 "Lakes"