Bersaelor / KDTree

Swift implementation of a k-dimensional binary space partitioning tree.
MIT License
153 stars 26 forks source link

add support for visionOS #62

Closed GerdC closed 7 months ago

GerdC commented 8 months ago

Doesn't compile for VisionOS:

import Foundation
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
    import CoreGraphics
#endif

extension CGPoint: KDTreePoint {
    public static var dimensions = 2

    public func kdDimension(_ dimension: Int) -> Double {
        return dimension == 0 ? Double(self.x) : Double(self.y)
    }

    public func squaredDistance(to otherPoint: CGPoint) -> Double {
        let x = self.x - otherPoint.x
        let y = self.y - otherPoint.y
        return Double(x*x + y*y)
    }
}

maybe adding ' || os(visionOS)' is all that is needed

to test, add 'Apple Vision' to a project, not only 'Apple Vision (designed for iPad)'

GerdC commented 7 months ago

I see the fix is already in master but not released. Could you release?

Bersaelor commented 7 months ago

Thank you for pointing this out, I completely forgot to publish a new release after the changes from last year!