1 |
//
|
|
2 |
// RouteComposer
|
|
3 |
// PostRoutingTaskMultiplexer.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 |
struct PostRoutingTaskMultiplexer: AnyPostRoutingTask, CustomStringConvertible {
|
|
17 |
|
|
18 |
private let tasks: [AnyPostRoutingTask]
|
|
19 |
|
|
20 |
init(_ tasks: [AnyPostRoutingTask]) {
|
2x |
21 |
self.tasks = tasks
|
2x |
22 |
}
|
2x |
23 |
|
|
24 |
func perform(on viewController: UIViewController, with context: AnyContext, routingStack: [UIViewController]) throws {
|
1x |
25 |
try tasks.forEach { try $0.perform(on: viewController, with: context, routingStack: routingStack) }
|
1x |
26 |
}
|
1x |
27 |
|
|
28 |
var description: String {
|
1x |
29 |
String(describing: tasks)
|
1x |
30 |
}
|
1x |
31 |
|
|
32 |
}
|
|