Skip to content

Commit d9fbb60

Browse files
authored
Fix @_spi errors (#339)
1 parent 7c6ab5c commit d9fbb60

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Changelog
33

44
## master
55

6+
- Fixed: `@_spi` errors (#339)
7+
68
## [0.11.0]
79

810
- Added: visionOS support (#327)

Sources/Introspect.swift

+13-16
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,17 @@ public protocol PlatformEntity: AnyObject {
108108
func isDescendant(of other: Base) -> Bool
109109
}
110110

111+
extension PlatformEntity {
112+
@_spi(Internals)
113+
public var ancestor: Base? { nil }
114+
115+
@_spi(Internals)
116+
public var descendants: [Base] { [] }
117+
118+
@_spi(Internals)
119+
public func isDescendant(of other: Base) -> Bool { false }
120+
}
121+
111122
extension PlatformEntity {
112123
@_spi(Internals)
113124
public var ancestors: some Sequence<Base> {
@@ -196,24 +207,10 @@ extension PlatformViewController: PlatformEntity {
196207

197208
#if canImport(UIKit)
198209
extension UIPresentationController: PlatformEntity {
199-
@_spi(Internals)
200-
public var ancestor: UIPresentationController? { nil }
201-
202-
@_spi(Internals)
203-
public var descendants: [UIPresentationController] { [] }
204-
205-
@_spi(Internals)
206-
public func isDescendant(of other: UIPresentationController) -> Bool { false }
210+
public typealias Base = UIPresentationController
207211
}
208212
#elseif canImport(AppKit)
209213
extension NSWindow: PlatformEntity {
210-
@_spi(Internals)
211-
public var ancestor: NSWindow? { nil }
212-
213-
@_spi(Internals)
214-
public var descendants: [NSWindow] { [] }
215-
216-
@_spi(Internals)
217-
public func isDescendant(of other: NSWindow) -> Bool { false }
214+
public typealias Base = NSWindow
218215
}
219216
#endif

0 commit comments

Comments
 (0)