wip
This commit is contained in:
parent
505604911c
commit
a767ddfb75
|
@ -58,9 +58,6 @@ extension View {
|
||||||
public protocol PlatformEntity: AnyObject {
|
public protocol PlatformEntity: AnyObject {
|
||||||
associatedtype Base: PlatformEntity
|
associatedtype Base: PlatformEntity
|
||||||
|
|
||||||
@_spi(Internals)
|
|
||||||
var isIntrospectionEntity: Bool { get }
|
|
||||||
|
|
||||||
@_spi(Internals)
|
@_spi(Internals)
|
||||||
var ancestor: Base? { get }
|
var ancestor: Base? { get }
|
||||||
|
|
||||||
|
@ -140,27 +137,12 @@ extension PlatformEntity {
|
||||||
) -> PlatformSpecificEntity? {
|
) -> PlatformSpecificEntity? {
|
||||||
self.ancestors
|
self.ancestors
|
||||||
.lazy
|
.lazy
|
||||||
.filter { !$0.isIntrospectionEntity }
|
|
||||||
.compactMap { $0 as? PlatformSpecificEntity }
|
.compactMap { $0 as? PlatformSpecificEntity }
|
||||||
.first
|
.first
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension PlatformView: PlatformEntity {
|
extension PlatformView: PlatformEntity {
|
||||||
@_spi(Internals)
|
|
||||||
public var isIntrospectionEntity: Bool {
|
|
||||||
#if canImport(UIKit)
|
|
||||||
if let next = self.next as? PlatformViewController {
|
|
||||||
return next.isIntrospectionEntity
|
|
||||||
}
|
|
||||||
#elseif canImport(AppKit)
|
|
||||||
if let next = self.nextResponder as? PlatformViewController {
|
|
||||||
return next.isIntrospectionEntity
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
@_spi(Internals)
|
@_spi(Internals)
|
||||||
public var ancestor: PlatformView? {
|
public var ancestor: PlatformView? {
|
||||||
superview
|
superview
|
||||||
|
@ -178,12 +160,6 @@ extension PlatformView: PlatformEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
extension PlatformViewController: PlatformEntity {
|
extension PlatformViewController: PlatformEntity {
|
||||||
@_spi(Internals)
|
|
||||||
public var isIntrospectionEntity: Bool {
|
|
||||||
return self is IntrospectionAnchorPlatformViewController
|
|
||||||
|| self is IntrospectionPlatformViewController
|
|
||||||
}
|
|
||||||
|
|
||||||
@_spi(Internals)
|
@_spi(Internals)
|
||||||
public var ancestor: PlatformViewController? {
|
public var ancestor: PlatformViewController? {
|
||||||
parent
|
parent
|
||||||
|
|
Loading…
Reference in New Issue