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
4 changes: 2 additions & 2 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Sources/OpenSwiftUICore/Event/Gesture/AnyGesture.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ public struct AnyGesture<Value>: PrimitiveGesture, Gesture {
inputs: _GestureInputs
) -> _GestureOutputs<Value> {
let outputs: _GestureOutputs<Value> = inputs.makeIndirectOutputs()
let currentSubgraph = Subgraph.current!
let info = Attribute(AnyGestureInfo<Value>(
gesture: gesture.value,
inputs: inputs,
outputs: outputs,
parentSubgraph: Subgraph.current!
parentSubgraph: currentSubgraph
))
info.setFlags(.active, mask: .mask)
outputs.setIndirectDependency(info.identifier)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// GestureContainerFactory.swift
// OpenSwiftUICore
//
// Status: Complete

// MARK: - GestureContainerFactory [6.5.4]

package protocol GestureContainerFactory {
static func makeGestureContainer(responder: any AnyGestureContainingResponder) -> AnyObject
}

package struct GestureContainerFactoryInput: ViewInput {
package static let defaultValue: (any GestureContainerFactory.Type)? = nil

package typealias Value = (any GestureContainerFactory.Type)?
}

extension _ViewInputs {
package func makeGestureContainer(responder: any AnyGestureContainingResponder) -> AnyObject {
guard let factory = self[GestureContainerFactoryInput.self] else {
preconditionFailure("Gesture container factory must be configured")
}
return factory.makeGestureContainer(responder: responder)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// GestureContainerFeature.swift
// OpenSwiftUICore
//
// Status: WIP

struct GestureContainerFeature {
static var isEnabled: Bool {
false
}
}
34 changes: 32 additions & 2 deletions Sources/OpenSwiftUICore/Event/Gesture/GestureGraph.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,45 @@ final package class GestureGraph: GraphHost, EventGraphHost, CustomStringConvert
delegate?.enqueueAction(action)
}

@inline(__always)
func access<T>(_ body: @autoclosure () -> T) -> T {
Update.perform {
instantiateIfNeeded()
return body()
}
}

package func gestureCategory() -> GestureCategory? {
guard let rootResponder, rootResponder.isValid else {
return nil
}
return access(gestureCategoryAttr)
}

@inline(__always)
var gestureLabel: String? {
guard isInstantiated else {
return nil
}
return Update.perform {
instantiateIfNeeded()
return gestureCategoryAttr
gestureLabelAttr ?? nil
}
}

@inline(__always)
var isCancellable: Bool {
access(isCancellableAttr ?? false)
}

@inline(__always)
var requiredTapCount: Int? {
access(requiredTapCountAttr ?? nil)
}

@inline(__always)
var gestureDependency: GestureDependency {
access(gestureDependencyAttr ?? .none)
}
}

extension GestureGraph {
Expand Down
Loading