LifecycleObserver
public struct LifecycleObserver : Element
Allows element lifecycle callbacks to be inserted anywhere into the element tree.
-
Declaration
Swift
public var wrapped: Element -
Declaration
Swift
public var onAppear: LifecycleCallback? -
Declaration
Swift
public var onDisappear: LifecycleCallback? -
Declaration
Swift
public init( onAppear: LifecycleCallback? = nil, onDisappear: LifecycleCallback? = nil, wrapping: Element ) -
Declaration
Swift
public var content: ElementContent { get } -
Declaration
Swift
public func backingViewDescription(with context: ViewDescriptionContext) -> ViewDescription? -
Adds a hook that will be called when this element appears.
Callbacks run in depth-first traversal order, with parents before children.
Declaration
Swift
public func onAppear(_ callback: @escaping LifecycleCallback) -> LifecycleObserver -
Adds a hook that will be called when this element disappears.
Callbacks run in depth-first traversal order, with parents before children. There is no guaranteed order between disappearance callbacks and backing views being removed from their superviews.
Declaration
Swift
public func onDisappear(_ callback: @escaping LifecycleCallback) -> LifecycleObserver
View on GitHub
LifecycleObserver Structure Reference