Can one set a "computed constant" in a Swift `struct`?

Viewed 1498

For convenience in naming constants I would like to do the following in Swift (my real case is less trivial) so I could refer to IntegerConstants.SIX in later code. However, SIX cannot be given a value because ONE and TWO do not have values till the struct has been initialized .. bit of a "Catch-22"

struct IntegerConstants {
   let ONE = 1.0
   let TWO = 2.0
   let SIX = (ONE + TWO) * TWO
}

Is there a way to do this, or an equivalent that creates a named constant of the form "GROUP.VALUE", that I have not yet discovered?

3 Answers
Related