Skip to content

Commit b706905

Browse files
authored
Add ViewRespondersKey (#176)
1 parent fb084bb commit b706905

File tree

6 files changed

+31
-8
lines changed

6 files changed

+31
-8
lines changed

Sources/OpenSwiftUICore/Data/Projection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public protocol Projection: Hashable {
1313
func set(base: inout Base, newValue: Projected)
1414
}
1515

16-
@_spi(ForSwiftUIOnly)
16+
@_spi(ForOpenSwiftUIOnly)
1717
extension Projection {
1818
package func composed<Tail>(with tail: Tail) -> ComposedProjection<Self, Tail> where Tail: Projection, Projected == Tail.Base {
1919
ComposedProjection(left: self, right: tail)

Sources/OpenSwiftUICore/Extension/CGPoint+Extension.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
public import Foundation
99

10-
@_spi(ForOpenSwiftUIOnly) public typealias PlatformPoint = CGPoint
10+
@_spi(ForOpenSwiftUIOnly)
11+
public typealias PlatformPoint = CGPoint
1112

1213
extension CGPoint {
1314
@inlinable

Sources/OpenSwiftUICore/View/Graph/ViewGraph.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ package final class ViewGraph: GraphHost {
3838
inputs.preferences.add(DisplayList.Key.self)
3939
}
4040
if contains(.viewResponders) {
41-
// inputs.preferences.add(ViewRespondersKey.self)
41+
inputs.preferences.add(ViewRespondersKey.self)
4242
}
4343
}
4444
}
@@ -77,7 +77,7 @@ package final class ViewGraph: GraphHost {
7777
var eventSubgraph: Subgraph?
7878

7979
@Attribute package var defaultLayoutComputer: LayoutComputer
80-
// @WeakAttribute var rootResponders: [ViewResponder]?
80+
@WeakAttribute var rootResponders: [ViewResponder]?
8181
@WeakAttribute var rootLayoutComputer: LayoutComputer?
8282
@WeakAttribute var rootDisplayList: (DisplayList, DisplayList.Version)?
8383

@@ -250,7 +250,7 @@ package final class ViewGraph: GraphHost {
250250
}
251251
}
252252
if requestedOutputs.contains(.viewResponders) {
253-
// _rootResponders = WeakAttribute(outputs.preferences[ViewRespondersKey.self])
253+
_rootResponders = WeakAttribute(outputs.preferences[ViewRespondersKey.self])
254254
}
255255
if requestedOutputs.contains(.layout) {
256256
_rootLayoutComputer = WeakAttribute(outputs.layoutComputer)
@@ -272,7 +272,7 @@ package final class ViewGraph: GraphHost {
272272
rootGeometry.$layoutDirection = nil
273273
}
274274
$rootLayoutComputer = nil
275-
// $rootResponders = nil
275+
$rootResponders = nil
276276
$rootDisplayList = nil
277277
hostPreferenceValues = WeakAttribute()
278278
#endif

Sources/OpenSwiftUICore/EventHandling/InputEvent/HitTesting/ContentResponder.swift renamed to Sources/OpenSwiftUICore/View/Responder/ContentResponder.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
// ContentResponder.swift
33
// OpenSwiftUI
44
//
5-
// Audited for iOS 15.5
5+
// Audited for iOS 18.0
66
// Status: WIP
77

88
package import Foundation
99
import OpenSwiftUI_SPI
1010

1111
package protocol ContentResponder {
12-
func contains(points: [CGPoint], size: CGSize) -> BitVector64
12+
func contains(points: [PlatformPoint], size: CGSize) -> BitVector64
1313
func contentPath(size: CGSize) -> Path
1414
func contentPath(size: CGSize, kind: ContentShapeKinds) -> Path
1515
}

Sources/OpenSwiftUICore/EventHandling/InputEvent/HitTesting/ContentShapeKinds.swift renamed to Sources/OpenSwiftUICore/View/Responder/ContentShapeKinds.swift

File renamed without changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// ViewRespondersKey.swift
3+
// OpenSwiftUICore
4+
//
5+
// Audited for iOS 18.0
6+
// Status: Empty
7+
8+
package struct ViewRespondersKey: PreferenceKey {
9+
package static var defaultValue: [ViewResponder] { [] }
10+
11+
package static var _includesRemovedValues: Bool { true }
12+
13+
package static func reduce(value: inout Value, nextValue: () -> Value) {
14+
value.append(contentsOf: nextValue())
15+
}
16+
}
17+
18+
// TODO
19+
20+
@_spi(ForOpenSwiftUIOnly)
21+
open class ViewResponder/*: ResponderNode, CustomStringConvertible, CustomRecursiveStringConvertible*/ {
22+
}

0 commit comments

Comments
 (0)