LED_ElementGrouping

public class LED_ElementGrouping : LED_Element, Sequence

This class allows you to specify a group of instances that follow the LED_Element Protocol, including other instances of LED_ElementGrouping. It can be iterated.

Groups handle layout as right to left (Least Significant to Most Significant). Element 0 will be rightmost.

  • The element types

    See more

    Declaration

    Swift

    public enum ElementTypes
  • This describes the layout

    Declaration

    Swift

    public typealias ElementLayout = (type: ElementTypes, value: Int)
  • This is the elements in this set

    Declaration

    Swift

    private let _containedElemnts: [LED_Element]
  • This is the size of the container

    Declaration

    Swift

    private var _containerSize: CGSize
  • This is how much space there is between elements

    Declaration

    Swift

    private var _separationSpace: CGFloat
  • The offset of the elements

    Declaration

    Swift

    private var _offsetPoint: CGPoint
  • This is the technical inititializer.

    Declaration

    Swift

    init(inElements: [LED_Element], inContainerSize: CGSize, inSeparationSpace: CGFloat)

    Parameters

    inElements

    This is an array of LED_Element objects, and is set without any interpretation. This cannot be changed after instantiation.

    inContainerSize

    This is a CGSize that represents the destination context. If it is CGSize.zero, then the default for the elements will be used. This can be changed.

    inSeparationSpace

    This is how many units (in destination context) will separate each of the elements (only applied if more than one element). This can be changed.

  • This is an inititializer that will instantiate the two basic elements, according to a map handed in.

    Declaration

    Swift

    convenience init(_ inElementLayout: [ElementLayout], inContainerSize: CGSize = CGSize.zero, inSeparationSpace: CGFloat = 12)

    Parameters

    inElements

    This is an array of ElementLayout tuples. It is interpreted for the types of instances to create. This cannot be changed after instantiation.

    inContainerSize

    This is a CGSize that represents the destination context. If it is CGSize.zero, then the default for the elements will be used. This can be changed. Default is CGSize.zero (Use element default).

    inSeparationSpace

    This is how many units (in destination context) will separate each of the elements (only applied if more than one element). This can be changed. Default is 12.

  • This returns a size that exactly fits all the contained elements with no spacing and no scaling.

    Declaration

    Swift

    private var _compositeSize: CGSize { get }
  • This calculates a scaling factor between the element context and the set external context.

    Declaration

    Swift

    private var _scalingFactor: CGPoint { get }
  • Get/set the display size for rendering.

    Declaration

    Swift

    public var containerSize: CGSize { get set }
  • Get/set the display rect (relative to the main rect) for rendering.

    Declaration

    Swift

    public var drawnFrame: CGRect { get }
  • Get/set the separation space for rendering.

    Declaration

    Swift

    public var separationSpace: CGFloat { get set }
  • Get the elements displayed by this grouping.

    Declaration

    Swift

    public var count: Int { get }
  • Get the elements displayed by this grouping.

    Declaration

    Swift

    public var elements: [LED_Element] { get }
  • Get the drawing size of this element.

    Declaration

    Swift

    public var drawingSize: CGSize { get }
  • Get all segments as one path.

    Declaration

    Swift

    public var allSegments: UIBezierPath { get }
  • Get active segments as one path.

    Declaration

    Swift

    public var activeSegments: UIBezierPath { get }
  • Get inactive segments as one path.

    Declaration

    Swift

    public var inactiveSegments: UIBezierPath { get }
  • Get one of the elements, by index.

    Declaration

    Swift

    public subscript(index: Int) -> LED_Element! { get }

    Parameters

    index

    The 0-based index of the element sought.

    Return Value

    The LED Element requested.

  • Create an iterator for this instance.

    This iterator follows the order of the array, starting from element 0, and working up to the end.

    Declaration

    Swift

    public func makeIterator() -> AnyIterator<LED_Element>

    Return Value

    an iterator for the contained elements.