18 lines
386 B
Swift
18 lines
386 B
Swift
|
//
|
||
|
// https://mczachurski.dev
|
||
|
// Copyright © 2023 Marcin Czachurski and the repository contributors.
|
||
|
// Licensed under the Apache License 2.0.
|
||
|
//
|
||
|
|
||
|
import SwiftUI
|
||
|
|
||
|
struct ViewOffsetKey: PreferenceKey {
|
||
|
typealias Value = CGFloat
|
||
|
|
||
|
static var defaultValue = CGFloat.zero
|
||
|
|
||
|
static func reduce(value: inout Value, nextValue: () -> Value) {
|
||
|
value += nextValue()
|
||
|
}
|
||
|
}
|