annotations(in:)
Returns the annotation objects within the specified map rectangle.
Declaration
func annotations(in mapRect: MKMapRect) -> Set<AnyHashable>Parameters
- mapRect:
The portion of the map that you want to search for annotations.
Return Value
The set of annotation objects within mapRect.
Discussion
This method offers a fast way to retrieve the annotation objects in a particular portion of the map. It’s much faster than doing a linear search of the objects in the annotations property yourself.