LifecycleHandler

public struct LifecycleHandler

Supported startup and shutdown method styles

  • Undocumented

    Declaration

    Swift

    public typealias Callback = (@escaping (Error?) -> Void) -> Void
  • Initialize a LifecycleHandler based on a completion handler.

    Declaration

    Swift

    public init(_ handler: ((@escaping (Error?) -> Void) -> Void)?)

    Parameters

    handler

    the underlying completion handler

  • Asynchronous LifecycleHandler based on a completion handler.

    Declaration

    Swift

    public static func async(_ handler: @escaping (@escaping (Error?) -> Void) -> Void) -> LifecycleHandler

    Parameters

    handler

    the underlying async handler

  • Asynchronous LifecycleHandler based on a blocking, throwing function.

    Declaration

    Swift

    public static func sync(_ body: @escaping () throws -> Void) -> LifecycleHandler

    Parameters

    body

    the underlying function

  • Noop LifecycleHandler.

    Declaration

    Swift

    public static var none: LifecycleHandler { get }