As we know struct and enum both are value type. We can define constants Like:
struct Foo {
static let constant = "SomeConstant"
}
print(Foo.constant)
enum Foo: String {
case constant = "SomeConstant"
}
print(Foo.constant.rawValue)
- Which one would make sense based on comparison of memory allocation at runtime ?
- Since both seems to be type-properties for me, will they remain forever in stack memory till app is alive.