Avatar
norio_nomura 6/1/2019 9:42 AM
@swift-main @ _propertyWrapper enum Lazy<Value> { case uninitialized(() -> Value) case initialized(Value) init(initialValue: @autoclosure @escaping () -> Value) { self = .uninitialized(initialValue) } var value: Value { mutating get { switch self { case .uninitialized(let initializer): let value = initializer() self = .initialized(value) return value case .initialized(let value): return value } } set { self = .initialized(newValue) } } } @Lazy var foo = 1738