ViewDescription

public struct ViewDescription

Contains a description of a UIView instance. A description includes logic to handle all parts of a view lifecycle from instantiation onward.

View descriptions include:

  • The view’s class.
  • How an instance of the view should be instantiated.
  • How to update a view instance by setting properties appropriately.
  • Which subview of a view instance should be used as a contain for additional subviews.
  • How to animate transitions for appearance, layout changes, and disappearance.
  • Hooks to be called during lifecycle events.

A view description does not contain a concrete view instance. It simply contains functionality for creating, updating, and animating view instances.

  • Generates a view description for the given view class.

    Declaration

    Swift

    public init(_ viewType: (some UIView).Type)

    Parameters

    viewType

    The class of the described view.

  • Generates a view description for the given view class.

    Declaration

    Swift

    public init<View>(_ type: View.Type, configuring: (inout Configuration<View>) -> Void) where View : UIView

    Parameters

    viewType

    The class of the described view.

    configuring

    A closure that is responsible for populating a configuration object.

  • Declaration

    Swift

    public var viewType: UIView.Type { get }
  • Declaration

    Swift

    public func build() -> UIView
  • Declaration

    Swift

    public func apply(to view: UIView)
  • Declaration

    Swift

    public func contentView(in view: UIView) -> UIView
  • Declaration

    Swift

    public var layoutTransition: LayoutTransition { get }
  • Declaration

    Swift

    public var appearingTransition: VisibilityTransition? { get }
  • Declaration

    Swift

    public var disappearingTransition: VisibilityTransition? { get }
  • The available prioritization options for rounding frames to pixel boundaries.

    See more

    Declaration

    Swift

    public enum FrameRoundingBehavior : Equatable
  • Represents the configuration of a specific UIView type.

    See more

    Declaration

    Swift

    public struct Configuration<View> where View : UIView