How to use in Frame for iOS? #8
-
The base protocol is PointN. for iOS slide, have a space zone by frame: CGRect So how define it? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
To use a Then, your I don't know what your use case is, but if you're working with CGRects you might be working with visual elements on screen. Thus, your data is changing at run time. This package stores data on disk, which might not be the best solution for you. If you're generating and using these trees at runtime, you might be better suited by Apple's GKRTree in GameplayKit. |
Beta Was this translation helpful? Give feedback.
To use a
CGRect
, you'd need to implementSpatialObject
conformance forCGRect
. For yourSpatialObject.Point
, you would could use a 2D Vector,Point2D
as described in the Readme, storing two 2D vectors for the top left and bottom right points of your CGRect.Then, your
minimumBoundingRectangle
would just be the top left and bottom right points of your CGRect. FordistanceSquared
, you'd need to find the shortest distance from your CGRect to the given point.I don't know what your use case is, but if you're working with CGRects you might be working with visual elements on screen. Thus, your data is changing at run time. This package stores data on disk, which might not be the best solution f…