Slather logo

Coverage for "ChainAssembly.swift" : 100.00%

(3 of 3 relevant lines covered)

RouteComposer/Classes/Assemblies/ChainAssembly.swift

1
//
2
// RouteComposer
3
// ChainAssembly.swift
4
// https://github.com/ekazaev/route-composer
5
//
6
// Created by Eugene Kazaev in 2018-2022.
7
// Distributed under the MIT license.
8
//
9
// Become a sponsor:
10
// https://github.com/sponsors/ekazaev
11
//
12
13
import Foundation
14
import UIKit
15
16
/// Builds a chain of steps.
17
public enum ChainAssembly {
18
19
    // MARK: Methods
20
21
    /// Transforms step into a chain of steps.
22
    /// ### Usage
23
    /// ```swift
24
    /// let intermediateStep = ChainAssembly.from(NavigationControllerStep<UINavigationController, Any?>())
25
    ///         .using(GeneralAction.presentModally())
26
    ///         .from(GeneralStep.current())
27
    ///         .assemble()
28
    /// ```
29
    /// - Parameter step: The instance of `ActionConnectingAssembly`
30
    public static func from<VC: UIViewController, C>(_ step: ActionToStepIntegrator<VC, C>) -> ActionConnectingAssembly<VC, C> {
8x
31
        ActionConnectingAssembly<VC, C>(stepToFullFill: step, previousSteps: [])
8x
32
    }
8x
33
34
}