Skip to content

Commit

Permalink
More helpers for ViewProducer
Browse files Browse the repository at this point in the history
  • Loading branch information
luizmb committed Mar 23, 2021
1 parent e4f9d93 commit 564ac5e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Sources/CombineRextensions/ViewProducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,17 @@ extension ViewProducer where ProducedView == EmptyView {
.init { _ in EmptyView() }
}
}

extension ViewProducer where ProducedView == AnyView {
public static func pure() -> ViewProducer {
.init { _ in AnyView(EmptyView()) }
}
}

#if DEBUG
extension ViewProducer {
public static var crash: ViewProducer {
. init { _ in fatalError("Debug ViewProducer crash") }
}
}
#endif

0 comments on commit 564ac5e

Please sign in to comment.