Skip to content

Commit

Permalink
Patch
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii committed Nov 14, 2024
1 parent 4e0e90d commit 2ba77e4
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SwiftUI

extension EnvironmentValues {
@Entry var _targetViewController: UIViewController?
@Entry public var storybook_targetViewController: UIViewController?
}
2 changes: 1 addition & 1 deletion Sources/StorybookKit/Primitives/BookAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import SwiftUI

public struct BookAction: BookView {

@Environment(\._targetViewController) var targetViewController
@Environment(\.storybook_targetViewController) var targetViewController

public let declarationIdentifier: DeclarationIdentifier

Expand Down
2 changes: 1 addition & 1 deletion Sources/StorybookKit/Primitives/BookPresent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import SwiftUI
/// A component descriptor that just displays UI-Component
public struct BookPresent: BookView {

@Environment(\._targetViewController) private var targetViewController
@Environment(\.storybook_targetViewController) private var targetViewController

public let declarationIdentifier: DeclarationIdentifier
public let presentedViewControllerBlock: @MainActor () -> UIViewController
Expand Down
4 changes: 2 additions & 2 deletions Sources/StorybookKit/Primitives/BookPush.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import SwiftUI
/// A component descriptor that previewing with push presentation.
public struct BookPush: BookView {

@Environment(\._targetViewController) var targetViewController
@Environment(\.storybook_targetViewController) var targetViewController

public let pushingViewControllerBlock: @MainActor () -> UIViewController
public let declarationIdentifier: DeclarationIdentifier
Expand All @@ -44,7 +44,7 @@ public struct BookPush: BookView {

NavigationLink(title, destination: {
_ViewControllerHost(instantiate: pushingViewControllerBlock)
.environment(\._targetViewController, targetViewController)
.environment(\.storybook_targetViewController, targetViewController)
})

}
Expand Down
2 changes: 1 addition & 1 deletion Sources/StorybookKit/StorybookDisplayRootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ final class _ViewController<Content: View>: UIViewController {
let hosting = UIHostingController(
rootView:
content
.environment(\._targetViewController, self)
.environment(\.storybook_targetViewController, self)
)

addChild(hosting)
Expand Down

0 comments on commit 2ba77e4

Please sign in to comment.