Skip to content

Commit 145b72b

Browse files
committed
Remove duplicated _forEachIdentifiedView
1 parent 2afca41 commit 145b72b

File tree

4 files changed

+17
-30
lines changed

4 files changed

+17
-30
lines changed

Sources/OpenSwiftUI/Integration/Hosting/AppKit/Controller/NSHostingController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ open class NSHostingController<Content>: NSViewController where Content: View {
142142

143143

144144
public func _forEachIdentifiedView(body: (_IdentifiedViewProxy) -> Void) {
145-
host._forEachIdentifiedView(body: body)
145+
host.forEachIdentifiedView(body: body)
146146
}
147147

148148

Sources/OpenSwiftUI/Integration/Hosting/AppKit/View/NSHostingView.swift

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -249,20 +249,6 @@ open class NSHostingView<Content>: NSView, XcodeViewDebugDataProvider where Cont
249249
// TODO
250250
}
251251

252-
// FIXME
253-
func _forEachIdentifiedView(body: (_IdentifiedViewProxy) -> Void) {
254-
let tree = preferenceValue(_IdentifiedViewsKey.self)
255-
let adjustment = { [weak self](rect: inout CGRect) in
256-
guard let self else { return }
257-
rect = convert(rect, from: nil)
258-
}
259-
tree.forEach { proxy in
260-
var proxy = proxy
261-
proxy.adjustment = adjustment
262-
body(proxy)
263-
}
264-
}
265-
266252
package func makeViewDebugData() -> Data? {
267253
Update.ensure {
268254
_ViewDebug.serializedData(viewGraph.viewDebugData())
@@ -423,4 +409,19 @@ extension NSHostingView: HostingViewProtocol {
423409
anchor.convert(to: viewGraph.transform)
424410
}
425411
}
412+
413+
extension NSHostingView/*: TestHost*/ {
414+
func forEachIdentifiedView(body: (_IdentifiedViewProxy) -> Void) {
415+
let tree = preferenceValue(_IdentifiedViewsKey.self)
416+
let adjustment = { [weak self](rect: inout CGRect) in
417+
guard let self else { return }
418+
rect = convert(rect, from: nil)
419+
}
420+
tree.forEach { proxy in
421+
var proxy = proxy
422+
proxy.adjustment = adjustment
423+
body(proxy)
424+
}
425+
}
426+
}
426427
#endif

Sources/OpenSwiftUI/Integration/Hosting/UIKit/Controller/UIHostingController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ open class UIHostingController<Content>: UIViewController where Content : View {
6868
}
6969

7070
public func _forEachIdentifiedView(body: (_IdentifiedViewProxy) -> Void) {
71-
host._forEachIdentifiedView(body: body)
71+
host.forEachIdentifiedView(body: body)
7272
}
7373

7474
@available(*, deprecated, message: "Use UIHostingController/safeAreaRegions or _UIHostingView/safeAreaRegions")

Sources/OpenSwiftUI/Integration/Hosting/UIKit/View/UIHostingView.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -431,20 +431,6 @@ open class _UIHostingView<Content>: UIView, XcodeViewDebugDataProvider where Con
431431
func clearUpdateTimer() {
432432
}
433433

434-
// FIXME
435-
func _forEachIdentifiedView(body: (_IdentifiedViewProxy) -> Void) {
436-
let tree = preferenceValue(_IdentifiedViewsKey.self)
437-
let adjustment = { [weak self](rect: inout CGRect) in
438-
guard let self else { return }
439-
rect = convert(rect, from: nil)
440-
}
441-
tree.forEach { proxy in
442-
var proxy = proxy
443-
proxy.adjustment = adjustment
444-
body(proxy)
445-
}
446-
}
447-
448434
@_spi(Private)
449435
@available(iOS, deprecated, message: "Use UIHostingController/safeAreaRegions or _UIHostingView/safeAreaRegions")
450436
final public var addsKeyboardToSafeAreaInsets: Bool {

0 commit comments

Comments
 (0)