Skip to content

Instantly share code, notes, and snippets.

@hhhello0507
Created March 25, 2025 12:44
Show Gist options
  • Save hhhello0507/c073605dfc8d5dabdd3f8153d9982bae to your computer and use it in GitHub Desktop.
Save hhhello0507/c073605dfc8d5dabdd3f8153d9982bae to your computer and use it in GitHub Desktop.
import SwiftUI
public struct ScrollOffsetPreferenceKey: PreferenceKey {
public static var defaultValue: CGFloat = 0
public static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) {
value += nextValue()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment