MotionRuntime.interactions specification
This is the engineering specification for the MotionRuntime
’s interactions
API.
Overview
This API retrieves interactions of a specific type associated with a given target via the .add
API.
let draggables = runtime.interactions(ofType: Draggable.self, for: view)
MVP
Expose an interactions API
The API should be generic on the Interaction type and accept a class and target.
class MotionRuntime {
public func interactions<I>(ofType: I.Type, for target: I.Target) -> [I] where I: Interaction
}
Cache interactions associated with targets in runtime.add
Each time an interaction is added to a target, cache that association in an internal map of targets to interactions.
Return all interactions of the desired type for the given target.
Return the list of interactions matching the desired type that were associated with the given target.