LayoutArrangement

public struct LayoutArrangement

The frame of a layout and the frames of its sublayouts.

  • Undocumented

    Declaration

    Swift

    public struct LayoutArrangement
  • Undocumented

    Declaration

    Swift

    public struct LayoutArrangement
  • Undocumented

    Declaration

    Swift

    public struct LayoutArrangement
  • Undocumented

    Declaration

    Swift

    public struct LayoutArrangement
  • Creates the views for the layout and adds them as subviews to the provided view. Existing subviews of the provided view will be removed. If no view is provided, then a new one is created and returned.

    MUST be run on the main thread.

    Declaration

    Swift

    public func makeViews(in view: View? = nil, direction: UserInterfaceLayoutDirection = .leftToRight) -> View

    Parameters

    view

    The layout’s views will be added as subviews to this view, if provided.

    direction

    The natural direction of the layout (default: .LeftToRight). If it does not match the user’s language direction, then the layout’s views will be flipped horizontally. Only provide this parameter if you want to test the flipped version of your layout, or if your layouts are declared for right-to-left languages and you want them to get flipped for left-to-right languages.

    Return Value

    The root view. If a view was provided, then the same view will be returned, otherwise, a new one will be created.

  • Prepares the view to be animated to this arrangement.

    Call prepareAnimation(for:direction) before the animation block. Call the returned animation’s apply() method inside the animation block.

    let animation = nextLayout.arrangement().prepareAnimation(for: rootView, direction: .RightToLeft)
    View.animateWithDuration(5.0, animations: {
        animation.apply()
    })
    

    Subviews are reparented for the new arrangement, if necessary, but frames are adjusted so locations don’t change. No frames or configurations of the new arrangement are applied until apply() is called on the returned animation object.

    MUST be run on the main thread.

    Declaration

    Swift

    public func prepareAnimation(for view: View, direction: UserInterfaceLayoutDirection = .leftToRight) -> Animation
  • Creates the views for the layout and adds them as subviews to the provided view. Existing subviews of the provided view will be removed. If no view is provided, then a new one is created and returned.

    MUST be run on the main thread.

    Declaration

    Swift

    public func makeViews(in view: View? = nil, direction: UserInterfaceLayoutDirection = .leftToRight) -> View

    Parameters

    view

    The layout’s views will be added as subviews to this view, if provided.

    direction

    The natural direction of the layout (default: .LeftToRight). If it does not match the user’s language direction, then the layout’s views will be flipped horizontally. Only provide this parameter if you want to test the flipped version of your layout, or if your layouts are declared for right-to-left languages and you want them to get flipped for left-to-right languages.

    Return Value

    The root view. If a view was provided, then the same view will be returned, otherwise, a new one will be created.

  • Prepares the view to be animated to this arrangement.

    Call prepareAnimation(for:direction) before the animation block. Call the returned animation’s apply() method inside the animation block.

    let animation = nextLayout.arrangement().prepareAnimation(for: rootView, direction: .RightToLeft)
    View.animateWithDuration(5.0, animations: {
        animation.apply()
    })
    

    Subviews are reparented for the new arrangement, if necessary, but frames are adjusted so locations don’t change. No frames or configurations of the new arrangement are applied until apply() is called on the returned animation object.

    MUST be run on the main thread.

    Declaration

    Swift

    public func prepareAnimation(for view: View, direction: UserInterfaceLayoutDirection = .leftToRight) -> Animation