Skip to content

Rename @_spi(Internals) to @_spi(Advanced) #290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Changelog

- Added: `Map` introspection (#288)
- Added: advanced range-based platform version predicates (#285)
- Changed: renamed `@_spi(Internals)` to `@_spi(Advanced)` (#290)
- Documentation: generate docs for extensions (#282)
- Infrastructure: set up `tea` for CI and local environments (#276)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ Implement your own selector
In case SwiftUIIntrospect doesn't support the SwiftUI element that you're looking for, you can implement your own selector. For example, to introspect a `TextField`:

```swift
@_spi(Internals) import SwiftUIIntrospect
@_spi(Advanced) import SwiftUIIntrospect

public struct TextFieldType: IntrospectableViewType {}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Introspect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ public struct IntrospectionScope: OptionSet {
/// Look for an `ancestor` relative to the `.introspect(...)` modifier.
public static let ancestor = Self(rawValue: 1 << 1)

@_spi(Private) public let rawValue: UInt
@_spi(Internals) public let rawValue: UInt

@_spi(Private) public init(rawValue: UInt) {
@_spi(Internals) public init(rawValue: UInt) {
self.rawValue = rawValue
}
}
Expand Down
10 changes: 5 additions & 5 deletions Sources/IntrospectionSelector.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@_spi(Internals)
@_spi(Advanced)
public struct IntrospectionSelector<Target: PlatformEntity> {
@_spi(Internals)
@_spi(Advanced)
public static var `default`: Self { .from(Target.self, selector: { $0 }) }

@_spi(Internals)
@_spi(Advanced)
public static func from<Entry: PlatformEntity>(_ entryType: Entry.Type, selector: @escaping (Entry) -> Target?) -> Self {
.init(
receiverSelector: { controller in
Expand All @@ -26,14 +26,14 @@ public struct IntrospectionSelector<Target: PlatformEntity> {
self.ancestorSelector = ancestorSelector
}

@_spi(Internals)
@_spi(Advanced)
public func withReceiverSelector(_ selector: @escaping (PlatformViewController) -> Target?) -> Self {
var copy = self
copy.receiverSelector = selector
return copy
}

@_spi(Internals)
@_spi(Advanced)
public func withAncestorSelector(_ selector: @escaping (PlatformViewController) -> Target?) -> Self {
var copy = self
copy.ancestorSelector = selector
Expand Down
8 changes: 4 additions & 4 deletions Sources/PlatformViewVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ public typealias macOSViewVersion<SwiftUIViewType: IntrospectableViewType, Platf
PlatformViewVersion<macOSVersion, SwiftUIViewType, PlatformSpecificEntity>

public enum PlatformViewVersion<Version: PlatformVersion, SwiftUIViewType: IntrospectableViewType, PlatformSpecificEntity: PlatformEntity> {
@_spi(Private) case available(Version, IntrospectionSelector<PlatformSpecificEntity>?)
@_spi(Private) case unavailable
@_spi(Internals) case available(Version, IntrospectionSelector<PlatformSpecificEntity>?)
@_spi(Internals) case unavailable

@_spi(Internals) public init(for version: Version, selector: IntrospectionSelector<PlatformSpecificEntity>? = nil) {
@_spi(Advanced) public init(for version: Version, selector: IntrospectionSelector<PlatformSpecificEntity>? = nil) {
self = .available(version, selector)
}

@_spi(Internals) public static func unavailable(file: StaticString = #file, line: UInt = #line) -> Self {
@_spi(Advanced) public static func unavailable(file: StaticString = #file, line: UInt = #line) -> Self {
let filePath = file.withUTF8Buffer { String(decoding: $0, as: UTF8.self) }
let fileName = URL(fileURLWithPath: filePath).lastPathComponent
runtimeWarn(
Expand Down