I want to write code for an enum of stationary that takes default values when nothing is mentioned. Is it possible to do so in Swift?
Here's an example of what I'm trying to do
public enum Stationary: someStationaryClass {
case pen (brand: Brands)
case paper (brand: Brands)
case pencil (brand: Brands)
}
public enum Brands {
case brand1
case brand2
}
Let's say the default value is brand1
.
So when I write
var item1 = Stationary.pen(brand: .brand2)
It is of brand2 but when I write
var item2 = Stationary.pen
It is of brand1 because we set that as the default value.
Any help?