Skip to content

Commit

Permalink
Fix @_spi errors (#339)
Browse files Browse the repository at this point in the history
  • Loading branch information
davdroman authored Aug 24, 2023
1 parent 7c6ab5c commit d9fbb60
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Changelog

## master

- Fixed: `@_spi` errors (#339)

## [0.11.0]

- Added: visionOS support (#327)
Expand Down
29 changes: 13 additions & 16 deletions Sources/Introspect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Base> {
Expand Down Expand Up @@ -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

0 comments on commit d9fbb60

Please sign in to comment.