18 lines
376 B
Swift
18 lines
376 B
Swift
//
|
|
// ViewOffsetKey.swift
|
|
// Jel
|
|
//
|
|
// Created by zerocool on 12/24/23.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
/// A preference key to store ScrollView offset
|
|
public struct ViewOffsetKey: PreferenceKey {
|
|
public typealias Value = CGFloat
|
|
public static var defaultValue = CGFloat.zero
|
|
public static func reduce(value: inout Value, nextValue: () -> Value) {
|
|
value += nextValue()
|
|
}
|
|
}
|