1- x.y.z Release notes (yyyy-MM-dd )
1+ 10.47.0 Release notes (2024-02-12 )
22=============================================================
3+
34### Enhancements
5+
46* Added initial support for geospatial queries on points.
57 There is no new dedicated type to store Geospatial points, instead points should
6- be stored as ([GeoJson-shaped](https://www.mongodb.com/docs/manual/reference/geojson/)) embedded object, as the example below.
8+ be stored as ([GeoJson-shaped](https://www.mongodb.com/docs/manual/reference/geojson/))
9+ embedded object, as the example below:
710 ```swift
811 public class Location: EmbeddedObject {
912 @Persisted private var coordinates: List<Double>
@@ -18,49 +21,44 @@ x.y.z Release notes (yyyy-MM-dd)
1821 coordinates.append(objectsIn: [longitude, latitude])
1922 }
2023 }
21- ```
22- Geospatial queries (`geoWithin`) can only be executed in such a type of objects and
23- will throw otherwise.
24- The queries can be used to filter objects whose points lie within a certain area,
25- using the following pre-established shapes (`GeoBox`, `GeoPolygon`, `GeoCircle`).
24+ ```
25+ Geospatial queries (`geoWithin`) can only be executed on such a type of
26+ objects and will throw otherwise. The queries can be used to filter objects
27+ whose points lie within a certain area, using the following pre-established
28+ shapes (`GeoBox`, `GeoPolygon`, `GeoCircle`).
2629 ```swift
2730 class Person: Object {
2831 @Persisted var name: String
2932 @Persisted var location: Location? // GeoJson embedded object
3033 }
31-
34+
3235 let realm = realmWithTestPath()
3336 try realm.write {
3437 realm.add(PersonLocation(name: "Maria", location: Location(latitude: 55.6761, longitude: 12.5683)))
3538 }
36-
39+
3740 let shape = GeoBox(bottomLeft: (55.6281, 12.0826), topRight: (55.6762, 12.5684))!
3841 let locations = realm.objects(PersonLocation.self).where { $0.location.geoWithin(shape) })
3942 ```
4043 A `filter` or `NSPredicate` can be used as well to perform a Geospatial query.
4144 ```swift
4245 let shape = GeoPolygon(outerRing: [(-2, -2), (-2, 2), (2, 2), (2, -2), (-2, -2)], holes: [[(0, 0), (1, 1), (-1, 1), (0, 0)]])!
4346 let locations = realm.objects(PersonLocation.self).filter("location IN %@", shape)
44-
47+
4548 let locations = realm.objects(PersonLocation.self).filter(NSPredicate(format: "location IN %@", shape))
4649 ```
4750
48- ### Fixed
49- * <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-swift/issues/????), since v?.?.?)
50- * None.
51-
52- <!-- ### Breaking Changes - ONLY INCLUDE FOR NEW MAJOR version -->
53-
5451### Compatibility
52+
5553* Realm Studio: 14.0.1 or later.
5654* APIs are backwards compatible with all previous releases in the 10.x.y series.
5755* Carthage release for Swift is built with Xcode 15.2.0.
5856* CocoaPods: 1.10 or later.
5957* Xcode: 14.2-15.2.0.
6058
6159### Internal
60+
6261* Migrated Release pipelines to Github Actions.
63- * Upgraded realm-core from ? to ?
6462
656310.46.0 Release notes (2024-01-23)
6664=============================================================
0 commit comments