class Foo {
let fooValue = 1
}
print(Foo.fooValue) // not work
class Bar {
static let barValue = 1
}
print(Bar.barValue) // work; print "1"
Why? I expected that Foo
example to work, because the value of fooValue
is constant, value and memory address known in compilation time. But I need use keyword static
to work.