Skip to content

Commit

Permalink
Add @_SPI(Internal) to some of navigation apis (#3097)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex293 committed May 17, 2024
1 parent 452155f commit bac0d10
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ extension DependencyValues {
public let next: @Sendable () -> StackElementID
public let peek: @Sendable () -> StackElementID

func callAsFunction() -> StackElementID {
@_spi(Internals)
public func callAsFunction() -> StackElementID {
self.next()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@ import SwiftUI
let line: UInt
@Environment(\.navigationDestinationType) var navigationDestinationType

@_spi(Internals)
public init(state: State?, @ViewBuilder label: () -> Label, fileID: StaticString, line: UInt) {
self.state = state
self.label = label()
self.fileID = fileID
self.line = line
}

public var body: some View {
#if DEBUG
self.label.onAppear {
Expand Down Expand Up @@ -331,7 +339,8 @@ import SwiftUI
}
}

var _isInPerceptionTracking: Bool {
@_spi(Internals)
public var _isInPerceptionTracking: Bool {
#if !os(visionOS)
return _PerceptionLocals.isInPerceptionTracking
#else
Expand All @@ -352,8 +361,16 @@ extension StackState {
}

public struct Component: Hashable {
let id: StackElementID
var element: Element
@_spi(Internals)
public let id: StackElementID
@_spi(Internals)
public var element: Element

@_spi(Internals)
public init(id: StackElementID, element: Element) {
self.id = id
self.element = element
}

public static func == (lhs: Self, rhs: Self) -> Bool {
lhs.id == rhs.id
Expand Down Expand Up @@ -416,7 +433,8 @@ private struct NavigationDestinationTypeKey: EnvironmentKey {
}

extension EnvironmentValues {
var navigationDestinationType: Any.Type? {
@_spi(Internals)
public var navigationDestinationType: Any.Type? {
get { self[NavigationDestinationTypeKey.self] }
set { self[NavigationDestinationTypeKey.self] = newValue }
}
Expand Down

0 comments on commit bac0d10

Please sign in to comment.