Protocols
The following protocols are available globally.
-
A
See moreDistanceSortFunction
that defines it’sdistancePoint
based on aDirection
. Any distance based sort functions that use a direction variable in order to determine the setup of the animation should implement this protocol.Declaration
Swift
public protocol DirectionSortFunction: DistanceSortFunction
-
A
See moreSortFunction
implementation that contain basic methods needed for doing distance comparisons. If you are implementing aSortFunction
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 standardSortFunction
.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
See moreSortFunction
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 customSortFunction
with Spruce.Declaration
Swift
public protocol SortFunction
-
Used to keep track of the
See moreUIView
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.Declaration
Swift
public protocol View
-
A
See moreDistanceSortFunction
that uses a position attribute to define an animation’s starting point.Declaration
Swift
public protocol PositionSortFunction: DistanceSortFunction
-
A
See moreSortFunction
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 lightverticalWeight
and a heavyhorizontalWeight
, 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 aradial
likeSortFunction
.Declaration
Swift
public protocol WeightSortFunction: SortFunction
-
A
See moreDistanceSortFunction
that uses a corner attribute to define an animation’s starting point.Declaration
Swift
public protocol CornerSortFunction: DistanceSortFunction