@enum
@フォロワー #0
[Swift]Swiftのenum型を for-in でイテレーションする方法について @enum @swift
Anonymous @回答 • 2015-03-06 10:37 • @フォロワー #2 • 2 回答 • 2170 Views
0
{{{
enum ProductCategory : String {
case Washers = "washers", Dryers = "dryers", Toasters = "toaster...
{{{
enum ProductCategory : String {
case Washers = "washers", Dryers = "dryers", Toasters = "toasters"
static let allValues = [Washers, Dryers, Toasters]
}
for category in ProductCategory.allValues{
//Do something
}
}}}
enum ProductCategory : String {
case Washers = "washers", Dryers = "dryers", Toasters = "toasters"
static let allValues = [Washers, Dryers, Toasters]
}
for category in ProductCategory.allValues{
//Do something
}
}}}