From 31b92c8a24e388c3795f43c2f2503625fa11142e Mon Sep 17 00:00:00 2001 From: Kyle Date: Mon, 2 Jun 2025 17:19:29 +0800 Subject: [PATCH 1/9] Update Placement indent --- .../Layout/Geometry/Placement.swift | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Sources/OpenSwiftUICore/Layout/Geometry/Placement.swift b/Sources/OpenSwiftUICore/Layout/Geometry/Placement.swift index cf197c06..394af06c 100644 --- a/Sources/OpenSwiftUICore/Layout/Geometry/Placement.swift +++ b/Sources/OpenSwiftUICore/Layout/Geometry/Placement.swift @@ -2,29 +2,29 @@ // Placement.swift // OpenSwiftUICore // -// Audited for iOS 18.0 // Status: Complete public import Foundation +// MARK: - Placement [6.4.41] + /// The position and proposed size of a child view, as determined by a layout. public struct _Placement: Equatable { - public var proposedSize: CGSize { get { proposedSize_.fixingUnspecifiedDimensions() } set { proposedSize_ = _ProposedSize(newValue) } } - + package var proposedSize_: _ProposedSize - + /// The relative position in the child's actual size that will be placed at /// `anchorPosition`. public var anchor: UnitPoint - + /// The location that the anchor will be given in the layout’s coordinate /// space. public var anchorPosition: CGPoint - + /// Creates an instance with the given `proposedSize`, anchoring `anchor` at /// `anchorPosition`. public init(proposedSize: CGSize, anchoring anchor: UnitPoint = .topLeading, at anchorPosition: CGPoint) { @@ -32,25 +32,25 @@ public struct _Placement: Equatable { self.anchor = anchor self.anchorPosition = anchorPosition } - + package init(proposedSize: _ProposedSize, anchoring anchor: UnitPoint, at anchorPosition: CGPoint) { self.proposedSize_ = proposedSize self.anchor = anchor self.anchorPosition = anchorPosition } - + package init(proposedSize: _ProposedSize, at anchorPosition: CGPoint) { self.proposedSize_ = proposedSize self.anchor = .topLeading self.anchorPosition = anchorPosition } - + package init(proposedSize: CGSize, aligning anchor: UnitPoint, in area: CGSize) { self.proposedSize_ = _ProposedSize(proposedSize) self.anchor = anchor self.anchorPosition = anchor.in(area) } - + package init(proposedSize: _ProposedSize, aligning anchor: UnitPoint, in area: CGSize) { self.proposedSize_ = proposedSize self.anchor = anchor From f8b9cae82988dfca29f1b902129098f88fe52cfd Mon Sep 17 00:00:00 2001 From: Kyle Date: Mon, 2 Jun 2025 18:04:24 +0800 Subject: [PATCH 2/9] Fix Animatable issue --- .../OpenSwiftUICore/View/Animation/Animation/Animatable.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/OpenSwiftUICore/View/Animation/Animation/Animatable.swift b/Sources/OpenSwiftUICore/View/Animation/Animation/Animatable.swift index 3cec021a..2332167b 100644 --- a/Sources/OpenSwiftUICore/View/Animation/Animation/Animatable.swift +++ b/Sources/OpenSwiftUICore/View/Animation/Animation/Animatable.swift @@ -43,8 +43,10 @@ extension Animatable where AnimatableData == EmptyAnimatableData { } extension Animatable { - package static func makeAnimatable(value: inout _GraphValue, inputs: _GraphInputs) { + package static func makeAnimatable(value: _GraphValue, inputs: _GraphInputs) -> Attribute { + var value = value _makeAnimatable(value: &value, inputs: inputs) + return value.value } } From bd4258914e6bed32b8c185c357e1737a13a34d0e Mon Sep 17 00:00:00 2001 From: Kyle Date: Mon, 2 Jun 2025 19:41:12 +0800 Subject: [PATCH 3/9] Add FrameVelocityFilter --- .../View/Animation/Animation/Animation.swift | 53 ------ .../Animation/Animation/CustomAnimation.swift | 163 ++++++++++++++++++ .../Animation/EmptyAnimatableData.swift | 7 - .../View/Graph/ViewGraph.swift | 6 +- 4 files changed, 165 insertions(+), 64 deletions(-) create mode 100644 Sources/OpenSwiftUICore/View/Animation/Animation/CustomAnimation.swift delete mode 100644 Sources/OpenSwiftUICore/View/Animation/Animation/EmptyAnimatableData.swift diff --git a/Sources/OpenSwiftUICore/View/Animation/Animation/Animation.swift b/Sources/OpenSwiftUICore/View/Animation/Animation/Animation.swift index 95e280e8..3ffde245 100644 --- a/Sources/OpenSwiftUICore/View/Animation/Animation/Animation.swift +++ b/Sources/OpenSwiftUICore/View/Animation/Animation/Animation.swift @@ -1,5 +1,3 @@ -package import OpenGraphShims - @frozen public struct Animation: Equatable { // var box: AnimationBoxBase @@ -10,54 +8,3 @@ public struct Animation: Equatable { public static var `default` = Animation() } - -// MARK: - AnimatableAttribute [6.4.41] [TODO] - -package struct AnimatableAttribute: StatefulRule, AsyncAttribute, ObservedAttribute, CustomStringConvertible where Value: Animatable { - @Attribute var source: Value - @Attribute var environment: EnvironmentValues - var helper: AnimatableAttributeHelper - - package init( - source: Attribute, - phase: Attribute<_GraphInputs.Phase>, - time: Attribute