Skip to content

Commit b8e966e

Browse files
authored
Merge pull request #62 from SoundBlaster/claude/restore-clregion-contains-01DFzFd11buq2gs1n35ha8DG
2 parents bd08d5d + bc73125 commit b8e966e

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

Sources/SpecificationKit/Providers/LocationContextProvider.swift

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,20 @@
481481
return distance <= circularRegion.radius
482482
}
483483

484-
// CLRegion.contains(_:) is deprecated across Apple platforms, so we only
485-
// evaluate circular regions directly. Non-circular regions fall back to false.
484+
// For non-circular regions (e.g., beacon regions, custom regions),
485+
// use the deprecated CLRegion.contains(_:) on platforms where it's still available
486+
#if os(macOS) || os(watchOS)
487+
// CLRegion.contains(_:) is deprecated but still functional on macOS and watchOS
488+
// Suppress the deprecation warning as we need to support non-circular regions
489+
if #available(macOS 11.0, watchOS 7.0, *) {
490+
return region.contains(currentLocation.coordinate)
491+
}
492+
return false
493+
#else
494+
// On iOS and other platforms where CLRegion.contains(_:) is unavailable,
495+
// non-circular regions cannot be evaluated
486496
return false
497+
#endif
487498
}
488499
}
489500

0 commit comments

Comments
 (0)