1 |
//
|
|
2 |
// RouteComposer
|
|
3 |
// InlinePostTask.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 |
/// `InlinePostTask` is the inline context task.
|
|
17 |
///
|
|
18 |
/// **NB:** It may be used for the purpose of configuration testing, but then replaced with a strongly typed
|
|
19 |
/// `PostRoutingTask` instance.
|
|
20 |
public struct InlinePostTask<VC: UIViewController, C>: PostRoutingTask {
|
|
21 |
|
|
22 |
// MARK: Properties
|
|
23 |
|
|
24 |
private let completion: (_: VC, _: C, _: [UIViewController]) -> Void
|
|
25 |
|
|
26 |
// MARK: Methods
|
|
27 |
|
|
28 |
/// Constructor
|
|
29 |
///
|
|
30 |
/// - Parameter completion: the block to be called when `InlinePostTask` will be called at the end of the navigation process
|
|
31 |
/// process.
|
|
32 |
public init(_ completion: @escaping (_: VC, _: C, _: [UIViewController]) -> Void) {
|
15x |
33 |
self.completion = completion
|
15x |
34 |
}
|
15x |
35 |
|
|
36 |
public func perform(on viewController: VC, with context: C, routingStack: [UIViewController]) {
|
19x |
37 |
completion(viewController, context, routingStack)
|
19x |
38 |
}
|
19x |
39 |
|
|
40 |
}
|
|