Protocols
The following protocols are available globally.
-
A
See moreDistanceSortFunctionthat defines it’sdistancePointbased 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 moreSortFunctionimplementation that contain basic methods needed for doing distance comparisons. If you are implementing aSortFunctionthat 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 moreSortFunctionis 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 customSortFunctionwith Spruce.Declaration
Swift
public protocol SortFunction
-
Used to keep track of the
See moreUIViewobject 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 moreDistanceSortFunctionthat uses a position attribute to define an animation’s starting point.Declaration
Swift
public protocol PositionSortFunction: DistanceSortFunction
-
A
See moreSortFunctionthat 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 lightverticalWeightand 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 aradiallikeSortFunction.Declaration
Swift
public protocol WeightSortFunction: SortFunction
-
A
See moreDistanceSortFunctionthat uses a corner attribute to define an animation’s starting point.Declaration
Swift
public protocol CornerSortFunction: DistanceSortFunction
View on GitHub
Protocols Reference