Skip to content

Commit

Permalink
Expose AnyScreen.wrappedScreen for inspection (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
amorde authored Feb 24, 2023
1 parent dbdcb96 commit 99024b5
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions WorkflowUI/Sources/Screen/AnyScreen/AnyScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,18 @@ import UIKit

public struct AnyScreen: Screen {
/// The original screen, retained for debugging
internal let wrappedScreen: Screen

/// Stored getter for the wrapped screen’s view controller description
private let _viewControllerDescription: (ViewEnvironment) -> ViewControllerDescription
public let wrappedScreen: Screen

public init<T: Screen>(_ screen: T) {
if let anyScreen = screen as? AnyScreen {
self = anyScreen
return
}
self.wrappedScreen = screen
self._viewControllerDescription = screen.viewControllerDescription(environment:)
}

public func viewControllerDescription(environment: ViewEnvironment) -> ViewControllerDescription {
// Passed straight through
return _viewControllerDescription(environment)
return wrappedScreen.viewControllerDescription(environment: environment)
}
}

Expand Down

0 comments on commit 99024b5

Please sign in to comment.