Protocols

The following protocols are available globally.

  • A SortFunction implementation that contain basic methods needed for doing distance comparisons. If you are implementing a SortFunction that considers distance to be one of it’s weighting mechanisms for sorting the views on the screen, then implementing this protocol would provide improvements over the standard SortFunction.

    See more

    Declaration

    Swift

    public protocol DistanceSortFunction: SortFunction
  • For all the views on the screen, we need to find some way of organizing them so that when we start the animation, each view will know when to start their individual animation. The concept of a SortFunction is just that. Given a view, the subviews of that view are sorted in a way that when animated they resemble the nature of that sort function. There are many different types of sort functions because there are so many ways to sort the subviews that are on the screen. If you don’t see a stock one that fits your need, feel free to implement this protocol and use your own custom SortFunction with Spruce.

    See more

    Declaration

    Swift

    public protocol SortFunction
  • Used to keep track of the UIView object and a changing reference point. Since Spruce allows for recursive subview lookup, we need to handle changing the coordinate space. Once the coordinate space has been accounted for we can then alter the reference point.

    See more

    Declaration

    Swift

    public protocol View
  • An animation type that handles how the views will change. Most of these are simply wrappers around the standard UIViewAnimation methods. This gives Spruce the flexibility to work with any style of animating.

    See more

    Declaration

    Swift

    public protocol Animation
  • A SortFunction that takes into account the vertical and horizontal weight of the position of views. The lighter the weight the the faster those views will start to animate. For example, if you had a light verticalWeight and a heavy horizontalWeight, the views that are vertically aligned with the starting position will animate before those that are horizontally aligned. This allows you to define the exact rigidness of a radial like SortFunction.

    See more

    Declaration

    Swift

    public protocol WeightSortFunction: SortFunction