Citation Language Guide - Properties - Stairway Saved Properties [emphasis mine]:
A lazy stored property is a property whose initial value is not calculated before first use.
I.e., . foo
foo
get
, nonmutating get
, Bar
lazy
foo
, mutating
getter.
Bar
foo
( ):
protocol Foo {
var foo: String { get }
}
class Bar: Foo {
lazy var foo: String = "Hello World"
}
, foo
foo
, mutating
getter.
protocol Foo {
var foo: String { mutating get }
}
struct Bar: Foo {
lazy var foo: String = "Hello World"
}
mutating
/nonmutating
. Q & A: