Skip to content

Commit

Permalink
Apply spi to 'View' modifiers.
Browse files Browse the repository at this point in the history
  • Loading branch information
filip-sakel committed Mar 5, 2021
1 parent 89e9aaa commit 4a59cfd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions Sources/TokamakCore/App/AppStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ struct DefaultAppStorageEnvironmentKey: EnvironmentKey {
}

public extension EnvironmentValues {
@_spi(TokamakCore)
var _defaultAppStorage: _StorageProvider? {
get {
self[DefaultAppStorageEnvironmentKey.self]
Expand Down
2 changes: 2 additions & 0 deletions Sources/TokamakCore/Modifiers/LifecycleModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@

// FIXME: these should have standalone implementations
public extension View {
@_spi(TokamakCore)
func _onMount(perform action: (() -> ())? = nil) -> some View {
modifier(_AppearanceActionModifier(appear: action))
}

@_spi(TokamakCore)
func _onUnmount(perform action: (() -> ())? = nil) -> some View {
modifier(_AppearanceActionModifier(disappear: action))
}
Expand Down
1 change: 1 addition & 0 deletions Sources/TokamakCore/State/TargetRef.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public struct _TargetRef<V: View, T>: View, TargetRefType {
public extension View {
/** Allows capturing target instance of aclosest descendant host view. The resulting instance
is written to a given `binding`. */
@_spi(TokamakCore)
func _targetRef<T: Target>(_ binding: Binding<T?>) -> _TargetRef<Self, T> {
.init(binding: binding, view: self)
}
Expand Down
1 change: 1 addition & 0 deletions Sources/TokamakCore/Styles/NavigationLinkStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ extension EnvironmentValues {
}

public extension View {
@_spi(TokamakCore)
func _navigationLinkStyle<S: _NavigationLinkStyle>(_ style: S) -> some View {
environment(\._navigationLinkStyle, _AnyNavigationLinkStyle(style))
}
Expand Down

0 comments on commit 4a59cfd

Please sign in to comment.