-
Notifications
You must be signed in to change notification settings - Fork 2
/
SignUpStepFactory.swift
38 lines (32 loc) · 1.39 KB
/
SignUpStepFactory.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// Created by Guillem on 22/7/22.
//
import Foundation
import FlowKit
struct SignUpStepFactory: StepFactory {
typealias OUTPUT = FlowOutputEmptyDefinition
typealias STEP = Step
func makeHandler(for stepRawType: String) -> AnyStepHandler<STEP, OUTPUT>? {
switch stepRawType {
case "TEXT_INPUT": return AnyStepHandler(textInputStepHandler())
case "INFO": return AnyStepHandler(infoStepHandler())
case "SUMMARY": return AnyStepHandler(flowSummaryStepHandler())
default: return nil
}
}
private func textInputStepHandler() -> StepHandler<TextInputStepHandlerDefinition> {
.create { _, stepContent, navigation, _, completion in
TextInputWireframe.push(on: navigation, content: stepContent, completion: completion)
}
}
private func infoStepHandler() -> StepHandler<InfoStepHandlerDefinition> {
.createWithEmptyOutput { _, stepContent, navigation, _, completion in
InfoWireframe.push(on: navigation, content: stepContent, completion: completion)
}
}
private func flowSummaryStepHandler() -> StepHandler<FlowSummaryStepHandlerDefinition> {
.createWithEmptyOutput { _, _, navigation, currentOutput, completion in
FlowSummaryWireframe.push(on: navigation, flowId: currentOutput.flowId, currentOutput: currentOutput.rawData, completion: completion)
}
}
}