The authors say townSize is declared using “nested enum Size in coordination with a closure” but it does not look like a typical closure to me. May you please advise me on how to interpret this? Any pointer would be appreciated.
Sorry for the noob question.
Thank you all for your time.
struct Town {
...
enum Size {
case small
case medium
case large
}
lazy var townSize: Size = {
switch self.population {
case 0...10_000:
return Size.small
case 10_001...100_000:
return Size.medium
default:
return Size.large
}
}()
}