'search only residential address with MapKit

In the project there is a searchcontroller and it displays the list of results when characters are typed in the searchbar. Currently MKLocalSearchCompleter returns good results. But is there a way to filter the results by residential address only. So far we have tried

completer.resultTypes = .address

and

completer.resultTypes = .query

We didn't achieve residential results only.

Tried adding completer.pointOfInterestFilter = MKPointOfInterestFilter.excludingAll but then MKLocalSearchCompleter fails with error. Any help filtering the search results by residential-only and using MapKit will be much appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source