Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import SnapshotTesting
@MainActor
@Suite(.snapshots(record: .never, diffTool: diffTool))
struct IgnoredByLayoutEffectUITests {
@Test(.disabled("Animation is not implmemented yet"))
@Test
func offsetIgnoredByLayout() {
struct ContentView: View {
var body: some View {
Expand Down
50 changes: 50 additions & 0 deletions Sources/OpenSwiftUI/Animation/Animatable/AnimatableModifier.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// AnimatableModifier.swift
// OpenSwiftUI
//
// Audited for 6.5.4
// Status: Complete

@_spi(ForOpenSwiftUIOnly)
import OpenSwiftUICore

/// A modifier that can create another modifier with animation.
@available(OpenSwiftUI_v1_0, *)
@available(*, deprecated, message: "use Animatable directly")
public protocol AnimatableModifier: Animatable, ViewModifier {}

@available(OpenSwiftUI_v1_0, *)
@available(*, deprecated, message: "use Animatable directly")
extension AnimatableModifier {
nonisolated public static func _makeView(
modifier: _GraphValue<Self>,
inputs: _ViewInputs,
body: @escaping (_Graph, _ViewInputs) -> _ViewOutputs
) -> _ViewOutputs {
let animatableViewModifier = makeAnimatable(
value: modifier,
inputs: inputs.base
)
return makeView(
modifier: _GraphValue(animatableViewModifier),
inputs: inputs,
body: body
)
}

nonisolated public static func _makeViewList(
modifier: _GraphValue<Self>,
inputs: _ViewListInputs,
body: @escaping (_Graph, _ViewListInputs) -> _ViewListOutputs
) -> _ViewListOutputs {
let animatableViewModifier = makeAnimatable(
value: modifier,
inputs: inputs.base
)
return makeViewList(
modifier: _GraphValue(animatableViewModifier),
inputs: inputs,
body: body
)
}
}
33 changes: 33 additions & 0 deletions Sources/OpenSwiftUI/Animation/Animatable/AnimatableView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// AnimatableView.swift
// OpenSwiftUI
//
// Audited for 6.5.4
// Status: Complete

@_spi(ForOpenSwiftUIOnly)
import OpenSwiftUICore

@available(OpenSwiftUI_v1_0, *)
@available(*, deprecated, message: "use Animatable directly")
public protocol _AnimatableView: Animatable, View {}

@available(OpenSwiftUI_v1_0, *)
@available(*, deprecated, message: "use Animatable directly")
extension _AnimatableView {
nonisolated public static func _makeView(
view: _GraphValue<Self>,
inputs: _ViewInputs
) -> _ViewOutputs {
let animatableView = makeAnimatable(value: view, inputs: inputs.base)
return makeView(view: _GraphValue(animatableView), inputs: inputs)
}

nonisolated public static func _makeViewList(
view: _GraphValue<Self>,
inputs: _ViewListInputs
) -> _ViewListOutputs {
let animatableView = makeAnimatable(value: view, inputs: inputs.base)
return makeViewList(view: _GraphValue(animatableView), inputs: inputs)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
// Animatable.swift
// OpenSwiftUICore
//
// Audited for 6.4.41
// Status: Complete

public import Foundation
package import OpenGraphShims

// MARK: - Animatable [6.4.41]
// MARK: - Animatable

/// A type that describes how to animate a property of a view.
public protocol Animatable {
Expand All @@ -22,7 +23,7 @@ public protocol Animatable {
static func _makeAnimatable(value: inout _GraphValue<Self>, inputs: _GraphInputs)
}

// MARK: - Animateble + Extension [6.4.41]
// MARK: - Animateble + Extension

extension Animatable where Self: VectorArithmetic {
public var animatableData: Self {
Expand Down Expand Up @@ -77,7 +78,7 @@ extension Animatable {
}
}

// MARK: - EmptyAnimatableData [6.4.41]
// MARK: - EmptyAnimatableData

/// An empty type for animatable data.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// AnimatableArray.swift
// OpenSwiftUICore
//
// Audited for iOS 18.0
// Audited for 6.0.87
// Status: Complete

package struct AnimatableArray<Element>: VectorArithmetic where Element: VectorArithmetic {
Expand Down
Loading