JJItemLayout

@objc
public class JJItemLayout : NSObject

Item layout

  • A closure that defines the layout of given action items relative to an action button.

    Declaration

    Swift

    @objc
    public var layout: (_ items: [JJActionItem], _ actionButton: JJFloatingActionButton) -> Void
  • Initializes and returns a newly allocated item layout object with given layout closure.

    Declaration

    Swift

    @objc
    public init(layout: @escaping (_ items: [JJActionItem], _ actionButton: JJFloatingActionButton) -> Void)

    Parameters

    layout

    A closure that defines the the layout of given action items relative to an action button.

    Return Value

    An initialized item layout object.

  • Returns an item layout object that places the items in a vertical line with given inter item spacing.

    Declaration

    Swift

    @objc
    public static func verticalLine(withInterItemSpacing interItemSpacing: CGFloat = 12,
                                    firstItemSpacing: CGFloat = 0) -> JJItemLayout

    Parameters

    interItemSpacing

    The distance between two adjacent items.

    firstItemSpacing

    The distance between the action button and the first action item. When firstItemSpacing is 0 or less interItemSpacing is used instead. Default is 0.

    Return Value

    An item layout object.

  • Returns an item layout object that places the items in a circle around the action button with given radius.

    Declaration

    Swift

    @objc
    public static func circular(withRadius radius: CGFloat = 100,
                                angleForItem: @escaping JJItemAngle = JJItemAnimationConfiguration.angleForItem)
        -> JJItemLayout

    Parameters

    radius

    The distance between the center of an item and the center of the button itself.

    angleForItem

    A closure that calculates the angle for each item in a floating action button. Default is JJItemAnimationConfiguration.angleForItem.

    Return Value

    An item layout object.