Skip to content

Commit

Permalink
make produceDirect work in unwind scenarios (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
klaidas-trafi authored Nov 6, 2023
1 parent c7f5c56 commit f5de659
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Sources/StoryFlow/Flow/ImplicitFlow/ImplicitFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,18 @@ extension Flow {
return
}

// MARK: Direct
// MARK: Direct Unwind

if let to = from.unwindVc(for: Swift.type(of: value)) {
to.handleUpdate(value, type)
let transition = TransitionInfo(from: from, producedType: output.type, receivedType: type, to: to, isUnwind: true)
if CustomTransition.attempt(transition) == false {
Transition.unwind().go(from, to)
}
return
}

// MARK: Direct Input

if let to = Flow<Any>.destination(for: (value, Swift.type(of: value))) {
let transition = TransitionInfo(from: from, producedType: Swift.type(of: value), receivedType: type, to: to, isUnwind: false)
Expand Down

0 comments on commit f5de659

Please sign in to comment.