Skip to content

Commit

Permalink
Don't allow AnyScreen to wrap itself (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
timdonnelly authored Apr 11, 2019
1 parent 45c8b4a commit 3beb41b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions swift/WorkflowUI/Sources/Screen/AnyScreen/AnyScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ public struct AnyScreen: Screen {
private let viewControllerBuilder: (ViewRegistry) -> AnyScreenViewController.WrappedViewController

public init<T: Screen>(_ screen: T) {
if let anyScreen = screen as? AnyScreen {
self = anyScreen
return
}
self.wrappedScreen = screen
self.viewControllerBuilder = { viewRegistry in
return viewRegistry.provideView(for: screen)
Expand Down

0 comments on commit 3beb41b

Please sign in to comment.