8
8
9
9
#if canImport(Darwin)
10
10
public import CoreGraphics
11
- #endif
11
+ import Foundation
12
+ #else
12
13
public import Foundation
14
+ #endif
13
15
package import OpenGraphShims
14
16
import OpenSwiftUI_SPI
15
17
@@ -629,6 +631,70 @@ extension Layout {
629
631
root: _GraphValue < Self > ,
630
632
inputs: _ViewInputs ,
631
633
body: ( _Graph , _ViewInputs ) -> _ViewListOutputs
634
+ ) -> _ViewOutputs {
635
+ var root = root
636
+ var inputs = inputs
637
+ _makeAnimatable ( value: & root, inputs: inputs. base)
638
+ let properties : LayoutProperties
639
+ if Self . self == AnyLayout . self {
640
+ let anyLayoutProperties = AnyLayoutProperties ( layout: root. value. unsafeCast ( to: AnyLayout . self) )
641
+ let dynamicStackOrientation = Attribute ( anyLayoutProperties)
642
+ inputs. dynamicStackOrientation = OptionalAttribute ( dynamicStackOrientation)
643
+ properties = LayoutProperties ( )
644
+ } else {
645
+ if let orientation = layoutProperties. stackOrientation {
646
+ inputs. stackOrientation = orientation
647
+ } else {
648
+ inputs. dynamicStackOrientation = OptionalAttribute ( )
649
+ }
650
+ properties = LayoutProperties ( )
651
+ }
652
+ inputs. stackOrientation = properties. stackOrientation
653
+ if inputs. archivedView. isArchived {
654
+ inputs. viewListOptions. formUnion ( . needsArchivedAnimationTraits)
655
+ }
656
+ let outputs = body ( _Graph ( ) , inputs)
657
+ switch outputs. views {
658
+ case let . staticList( elements) :
659
+ if inputs. needsDynamicLayout {
660
+ return makeDynamicView (
661
+ root: root,
662
+ inputs: inputs,
663
+ properties: properties,
664
+ list: outputs. makeAttribute ( viewInputs: inputs)
665
+ )
666
+ } else {
667
+ return makeStaticView (
668
+ root: root,
669
+ inputs: inputs,
670
+ properties: properties,
671
+ list: elements
672
+ )
673
+ }
674
+ case let . dynamicList( viewList, modifier) :
675
+ return makeDynamicView (
676
+ root: root,
677
+ inputs: inputs,
678
+ properties: properties,
679
+ list: outputs. makeAttribute ( viewInputs: inputs)
680
+ )
681
+ }
682
+ }
683
+
684
+ static func makeDynamicView(
685
+ root: _GraphValue < Self > ,
686
+ inputs: _ViewInputs ,
687
+ properties: LayoutProperties ,
688
+ list: Attribute < any ViewList >
689
+ ) -> _ViewOutputs {
690
+ preconditionFailure ( " TODO " )
691
+ }
692
+
693
+ static func makeStaticView(
694
+ root: _GraphValue < Self > ,
695
+ inputs: _ViewInputs ,
696
+ properties: LayoutProperties ,
697
+ list: ViewList . Elements
632
698
) -> _ViewOutputs {
633
699
preconditionFailure ( " TODO " )
634
700
}
@@ -639,7 +705,7 @@ extension Layout {
639
705
rule: inout R ,
640
706
layoutContext ctx: SizeAndSpacingContext ,
641
707
children: LayoutProxyCollection
642
- ) where R : StatefulRule , R. Value == LayoutComputer {
708
+ ) where R: StatefulRule , R. Value == LayoutComputer {
643
709
preconditionFailure ( " TODO " )
644
710
}
645
711
0 commit comments