Skip to content

How to use in Frame for iOS? #8

Answered by emma-k-alexandra
RbBtSn0w asked this question in Q&A
Discussion options

You must be logged in to vote

To use a CGRect, you'd need to implement SpatialObject conformance for CGRect. For your SpatialObject.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. For distanceSquared, 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…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@RbBtSn0w
Comment options

Answer selected by RbBtSn0w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants