Slather logo

Coverage for "NilFinder.swift" : 100.00%

(4 of 4 relevant lines covered)

RouteComposer/Classes/Finders/NilFinder.swift

1
//
2
// RouteComposer
3
// NilFinder.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
/// Dummy struct used to represent that nothing should be found in a view controller stack
17
/// and a `UIViewController` should always be created from scratch.
18
/// Its only purpose is to provide type safety checks for `StepAssembly`.
19
///
20
/// For example, `UIViewController` of this step was already loaded and integrated into a stack by a storyboard.
21
public struct NilFinder<VC: UIViewController, C>: Finder, NilEntity {
22
23
    // MARK: Associated types
24
25
    public typealias ViewController = VC
26
27
    public typealias Context = C
28
29
    // MARK: Methods
30
31
    /// Constructor
32
    public init() {}
80x
33
34
    /// `Finder` method empty implementation.
35
    ///
36
    /// - Parameter context: A context instance provided.
37
    /// - Returns: always `nil`.
38
    public func findViewController(with context: C) throws -> VC? {
2x
39
        nil
2x
40
    }
2x
41
42
}