Skip to content
Closed
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
78 changes: 65 additions & 13 deletions Sources/OpenSwiftUICore/Render/RendererLeafView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Status: WIP

package import Foundation
import OpenAttributeGraphShims
package import OpenAttributeGraphShims

// MARK: - RendererLeafView [TODO]

Expand All @@ -26,24 +26,76 @@ extension RendererLeafView {
}

package static func makeLeafView(view: _GraphValue<Self>, inputs: _ViewInputs) -> _ViewOutputs {
// TODO
var outputs = _ViewOutputs()
// FIXME
outputs.preferences.displayList = Attribute(
LeafDisplayList(
identity: .init(),
view: view.value,
position: inputs.animatedPosition(),
size: inputs.animatedCGSize(),
containerPosition: inputs.containerPosition,
options: .defaultValue,
contentSeed: .init()

if inputs.preferences.requiresDisplayList {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed on ViewHidden. And I have fixed in #612

let identity = DisplayList.Identity()
inputs.pushIdentity(identity)

outputs.preferences.displayList = Attribute(
LeafDisplayList(
identity: identity,
view: view.value,
position: inputs.animatedPosition(),
size: inputs.animatedCGSize(),
containerPosition: inputs.containerPosition,
options: inputs.displayListOptions,
contentSeed: DisplayList.Seed()
)
)
)
}

if inputs.preferences.requiresViewResponders {
outputs.preferences.viewResponders = Attribute(
LeafResponderFilter(
data: view.value,
size: inputs.animatedSize(),
position: inputs.animatedPosition(),
transform: inputs.transform
)
)
}
Comment on lines +48 to +57
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gesture and ViewResponder system is not ready yet. And this PR does not implement them either.


// TODO
// outputs.makeContentPathPreferenceWriter(
// inputs: inputs,
// contentResponder: view.value
// )

return outputs
}
}

package struct LeafResponderFilter<Data>: StatefulRule {
@Attribute private var data: Data
@Attribute private var size: ViewSize
@Attribute private var position: CGPoint
@Attribute private var transform: ViewTransform
package private(set) lazy var responder = LeafViewResponder<Data>()

package init(
data: Attribute<Data>,
size: Attribute<ViewSize>,
position: Attribute<CGPoint>,
transform: Attribute<ViewTransform>
) {
self._data = data
self._size = size
self._position = position
self._transform = transform
}

package typealias Value = [ViewResponder]

package func updateValue() {
_openSwiftUIUnimplementedWarning()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll implement and test it when Gesture is ready. Looks like currently we do not need those.

}
}

package final class LeafViewResponder<Data>: ViewResponder {
// TODO
}

// MARK: - LeafViewLayout

package protocol LeafViewLayout {
Expand Down
Loading