Skip to content

Commit

Permalink
Rename @_spi(Internals) to @_spi(Advanced) (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
davdroman authored Jul 1, 2023
1 parent 005d009 commit d49a578
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
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

0 comments on commit d49a578

Please sign in to comment.