From ff37d2828b3f06b4c921005e8f0c0bd49c3717f4 Mon Sep 17 00:00:00 2001 From: Yang Xu Date: Mon, 12 Sep 2022 11:36:32 +0800 Subject: [PATCH] update PreferenceKey --- Sources/IsScrolling/IsScrolling.swift | 2 +- Sources/IsScrolling/Key.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/IsScrolling/IsScrolling.swift b/Sources/IsScrolling/IsScrolling.swift index 29abbac..1659b01 100644 --- a/Sources/IsScrolling/IsScrolling.swift +++ b/Sources/IsScrolling/IsScrolling.swift @@ -28,7 +28,7 @@ public extension View { Color.clear .preference( key: MinValueKey.self, - value: .init(x: proxy.frame(in: .global).minX, y: proxy.frame(in: .global).minY) + value: proxy.frame(in: .global) ) } ) diff --git a/Sources/IsScrolling/Key.swift b/Sources/IsScrolling/Key.swift index d1eb1bf..47f2f53 100644 --- a/Sources/IsScrolling/Key.swift +++ b/Sources/IsScrolling/Key.swift @@ -20,8 +20,8 @@ public extension EnvironmentValues { } public struct MinValueKey: PreferenceKey { - public static var defaultValue: CGPoint = .zero - public static func reduce(value: inout CGPoint, nextValue: () -> CGPoint) { + public static var defaultValue: CGRect = .zero + public static func reduce(value: inout CGRect, nextValue: () -> CGRect) { value = nextValue() } }