PropertyStates

public struct PropertyStates

This struct represents the states of a single object property, to be used in a motion operation. Because the start and end properties can represent any value type, it is used to create Motion objects that conveniently handle many property value interpolations by simply passing in representations of that object at its starting and ending points.

Remark

These state values must be of the same object type as the property located at the keypath. For instance, if the path property points to a CGRect object, you must provide CGRect objects for the start and end properties.
  • The keyPath of the property to be transformed. The keyPath must be a valid, KVC-compliant keyPath of targetObject. For your own classes, you must flag the property with @objc for Swift to find it.

    Seealso

    targetObject

    Declaration

    Swift

    public let path: String
  • An optional starting value of the motion operation.

    Remark

    In typical cases, not specifying a starting value will result in the Motion class using the property’s current value at the time the Motion is created. Note that for non-numeric properties like structs this may affect multiple values, such as the x and y properties of CGPoint.

    Warning

    This value must be of the same object type as the property located at the specified path. For instance, if you’re modifying a CGRect object, you must provide a CGRect object here.

    Seealso

    end

    Declaration

    Swift

    public var start: Any?
  • end

    The ending value of the motion operation.

    Remark

    Note that for non-numeric properties like structs this may affect multiple values, such as the x and y properties of CGPoint.

    Warning

    This value must be of the same object type as the property located at the specified path. For instance, if you’re modifying a CGRect object, you must provide a CGRect object here.

    Declaration

    Swift

    public var end: Any
  • Initializer.

    Declaration

    Swift

    public init(path: String, start: Any?=nil, end: Any)

    Parameters

    path

    The keypath of the property to modify, relative to the target object provided to a Motion.

    start

    An optional starting value for the motion.

    end

    The ending value of the motion.