FlowElementContainer

public class FlowElementContainer<T>

The idea of have FlowElementContainer is a way of have the reference encapsulated inside a object that we can manage the reference to our real object, as we will be using this inside an array, we need to be able to destroy easily our array without have the risk of some view controller hold the reference to the object

  • Enum that will say which type of the registration you want to your instance

    Declaration

    Swift

    public enum Scope
  • Typealias

    Declaration

    Swift

    public typealias Container = () -> T?
  • Flow element container initialiser

    Declaration

    Swift

    public init(for type: T.Type, resolving: @escaping Container)

    Parameters

    for

    The type of the View Controller that you want to register.

    resolving

    Is the closure that will be called when Flow Manager need to get the instance of the type that you declared

  • Flow element container initialiser

    Declaration

    Swift

    public init(for type: T.Type, customIdentifier: String, resolving: @escaping Container)

    Parameters

    for

    The type of the View Controller that you want to register.

    customIdentifier

    String that is custom identifier to identify particular view

    resolving

    Is the closure that will be called when Flow Manager need to get the instance of the type that you declared

  • Flow element container initialiser for when you want to resolving receiving the parameters from the caller

    Declaration

    Swift

    public init(for type: T.Type, with arg: Any, resolving: CallbackFunctionType)

    Parameters

    for

    The type of the View Controller that you want to register.

    with

    The arguments that you will want to have, Any as type.

    resolving

    Is the closure that will be called when Flow Manager need to get the instance of the type that you declared.

  • Flow element container initialiser for when you want to resolving receiving the parameters from the caller

    Declaration

    Swift

    public init(for type: T.Type, customIdentifier: String, with arg: Any, resolving: CallbackFunctionType)

    Parameters

    for

    The type of the View Controller that you want to register.

    customIdentifier

    String that is custom identifier to identify particular view

    with

    The arguments that you will want to have, Any as type.

    resolving

    Is the closure that will be called when Flow Manager need to get the instance of the type that you declared.

  • Set the scope that we will want for this object

    Note

    It has @discardableResult because you can use other helper methods just after calling this method as we always return FlowElementContainer instance.

    Declaration

    Swift

    @discardableResult
    public func inScope(scope: Scope) -> Self

    Parameters

    scope

    The scope that you want to have your instance reference, .weak, .strong, or default is .none

  • Return the type of this element

    Declaration

    Swift

    public func type() -> T.Type
  • Return the identifier of this element

    Declaration

    Swift

    public func identifier() -> String?