diff --git a/CHANGELOG.md b/CHANGELOG.md index 43c0d122..561f686e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ Changelog ## master +- Fixed: `@_spi` errors (#339) + ## [0.11.0] - Added: visionOS support (#327) diff --git a/Sources/Introspect.swift b/Sources/Introspect.swift index 272f0e89..58fcae89 100644 --- a/Sources/Introspect.swift +++ b/Sources/Introspect.swift @@ -108,6 +108,17 @@ public protocol PlatformEntity: AnyObject { func isDescendant(of other: Base) -> Bool } +extension PlatformEntity { + @_spi(Internals) + public var ancestor: Base? { nil } + + @_spi(Internals) + public var descendants: [Base] { [] } + + @_spi(Internals) + public func isDescendant(of other: Base) -> Bool { false } +} + extension PlatformEntity { @_spi(Internals) public var ancestors: some Sequence { @@ -196,24 +207,10 @@ extension PlatformViewController: PlatformEntity { #if canImport(UIKit) extension UIPresentationController: PlatformEntity { - @_spi(Internals) - public var ancestor: UIPresentationController? { nil } - - @_spi(Internals) - public var descendants: [UIPresentationController] { [] } - - @_spi(Internals) - public func isDescendant(of other: UIPresentationController) -> Bool { false } + public typealias Base = UIPresentationController } #elseif canImport(AppKit) extension NSWindow: PlatformEntity { - @_spi(Internals) - public var ancestor: NSWindow? { nil } - - @_spi(Internals) - public var descendants: [NSWindow] { [] } - - @_spi(Internals) - public func isDescendant(of other: NSWindow) -> Bool { false } + public typealias Base = NSWindow } #endif