Skip to content

Commit bac0d10

Browse files
authored
Add @_SPI(Internal) to some of navigation apis (#3097)
1 parent 452155f commit bac0d10

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

Sources/ComposableArchitecture/Internal/StackIDGenerator.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ extension DependencyValues {
1111
public let next: @Sendable () -> StackElementID
1212
public let peek: @Sendable () -> StackElementID
1313

14-
func callAsFunction() -> StackElementID {
14+
@_spi(Internals)
15+
public func callAsFunction() -> StackElementID {
1516
self.next()
1617
}
1718

Sources/ComposableArchitecture/Observation/NavigationStack+Observation.swift

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,14 @@ import SwiftUI
237237
let line: UInt
238238
@Environment(\.navigationDestinationType) var navigationDestinationType
239239

240+
@_spi(Internals)
241+
public init(state: State?, @ViewBuilder label: () -> Label, fileID: StaticString, line: UInt) {
242+
self.state = state
243+
self.label = label()
244+
self.fileID = fileID
245+
self.line = line
246+
}
247+
240248
public var body: some View {
241249
#if DEBUG
242250
self.label.onAppear {
@@ -331,7 +339,8 @@ import SwiftUI
331339
}
332340
}
333341

334-
var _isInPerceptionTracking: Bool {
342+
@_spi(Internals)
343+
public var _isInPerceptionTracking: Bool {
335344
#if !os(visionOS)
336345
return _PerceptionLocals.isInPerceptionTracking
337346
#else
@@ -352,8 +361,16 @@ extension StackState {
352361
}
353362

354363
public struct Component: Hashable {
355-
let id: StackElementID
356-
var element: Element
364+
@_spi(Internals)
365+
public let id: StackElementID
366+
@_spi(Internals)
367+
public var element: Element
368+
369+
@_spi(Internals)
370+
public init(id: StackElementID, element: Element) {
371+
self.id = id
372+
self.element = element
373+
}
357374

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

418435
extension EnvironmentValues {
419-
var navigationDestinationType: Any.Type? {
436+
@_spi(Internals)
437+
public var navigationDestinationType: Any.Type? {
420438
get { self[NavigationDestinationTypeKey.self] }
421439
set { self[NavigationDestinationTypeKey.self] = newValue }
422440
}

0 commit comments

Comments
 (0)