Module

public class Module<ModuleConfig> : Equatable, @unchecked Sendable where ModuleConfig : Sendable

A Module represents a unit of functionality in the application.

  • property config: A function that returns the configuration for the module.
  • property setup: A function that sets up the module.
  • Declaration

    Swift

    public private(set) var setup: @Sendable (Setup<ModuleConfig>) -> (Void) { get }
  • Declaration

    Swift

    public private(set) var config: @Sendable () -> (ModuleConfig) { get }
  • id

    The unique identifier of the module.

    Declaration

    Swift

    public var id: UUID
  • Constructs a module with config.

    Declaration

    Swift

    public init(config: @escaping @Sendable () -> (ModuleConfig), setup: @escaping @Sendable (Setup<ModuleConfig>) -> (Void))
  • Constructs a module with config.

    Declaration

    Swift

    public static func of(_ config: @escaping @Sendable () -> (ModuleConfig) = {},
                          setup: @escaping @Sendable (Setup<ModuleConfig>) -> (Void)
    ) -> Module<ModuleConfig>

    Parameters

    config

    A function that returns the configuration for the module.

    setup

    A function that sets up the module.

    Return Value

    A Module with the provided config.

  • Compares two modules.

    Declaration

    Swift

    public static func == (lhs: Module<ModuleConfig>, rhs: Module<ModuleConfig>) -> Bool

    Parameters

    lhs

    The left-hand module.

    rhs

    The right-hand module.

    Return Value

    A boolean value indicating whether the two modules are equal.