jel/Jel/Models/ViewOffsetKey.swift

18 lines
376 B
Swift
Raw Normal View History

2023-12-25 01:01:52 +00:00
//
// 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()
}
}