Greetings again!
Most recently, I published an article literally saturated with love for Yandex.Maps. The poem. Ode. Here, in fact, she
habr.com/en/post/479102Having made sure that among programmers there are few lovers of poetry, I nevertheless decided to illuminate the situation in a more “HABRovsky” way. Catch a bunch of code, thoughts and screenshots. Go.

Start over.
The task is trivial:
when you enter the controller with the cards, you need to immediately “zoom out” to the user's point (bonus: you would also need to get the address in a readable form along with all available atibutes).We cut the analyst: "Divide and conquer."To achieve this goal, it is necessary to solve a number of technical and business problems, namely:
0. Go to the controller with a potential module for working with geo-positioning (MRSG), callbacks, etc.
1. IWG
1.1 Implement the IWG
1.2 Launch IWG
1.2.1 Get user coordinates
1.2.2 Take a look at him
2 *. Get the position address in a readable format.
Switching to the controller (VIPER + Configurator)
extension AddPresenter: AddPresentationLogic {
The delegate has only one function so that when you specify the desired point, you can return it via protocol to the controller that calls the controller with the card:
protocol YandexMapSetPointViewControllerProtocol { func didSelectPoint(_ place: Place) }
To the delegate, we send the control part of the calling code. Everything seems to be clear here.
This is how unpretentious we go to the controller ...

The crosshair in the center is located exactly in the center of the controller and in the center of the UIView maps. The assumption that zooming inside maps will work by default in the center of the window. And so it turned out.
To the left and just below the crosshairs - UILabel. It is planned to display a readable address there. Right button with UIActivityIndicator. The point is that until the user’s coordinates have arrived, he “rotates” and the button is darkened and disabled. By clicking on the button with the received coordinates of the user, we return the crosshair to him.
This is an indication of the position, starting from the user's position.At the bottom is the "Select Point" button. By clicking, the magic of business logic occurs:
@IBAction func selectButtonWasPressed(_ sender: Any) { let place = Place() place.name = " " place.point.latitude = "\(String(describing: selectedPoint!.latitude))" place.point.longitude = "\(String(describing: selectedPoint!.longitude))" place.addressText = selectedPointGeocoderedAddress delegate?.didSelectPoint(place) navigationController?.popViewController(animated: true) }
Hurrah! We discussed the preparatory phase!We proceed to the MRSG.
Below is a table-formatted text that
personally reflects
my assessments (with fuzzy elements) of the most famous (at that time I did not know about
www.openstreetmap.org , thanks,
daglob ) built-in map modules.

“Since the task is simple, I use Yandex.Maps. They are beautiful, nimble ... "- I thought.
If you are interested in how to configure this, write a mini-project, but if you are too lazy -
tech.yandex.ru/maps/mapkit/?from=mapsapi , get on the track of my path. Getting started is easy.
The fact is that the documentation is presented in this form:

Pay attention to the meager description and the huge list of objects on the left. Damn your leg.
“Probably the test project will answer my questions.” Oh well.
Here is this beast.
github.com/yandex/mapkit-ios-demoI did not see solutions for my trivial task there.
- Okay, - I think - I have enough experience, if I’m not a developer.

I assembled a test project and looked at the feature of customizing the user's marker for a long time.
Key points:
There is an object:
@IBOutlet weak var mapView: YMKMapView!
“Everything seems to be logical,” you say. But no. Alternative methods:
func onObjectAdded(with view: YMKUserLocationView) {} func onObjectRemoved(with view: YMKUserLocationView) {} func onObjectUpdated(with view: YMKUserLocationView, event: YMKObjectEvent) {}
we get the opportunity to get to point.lat and point.long in extremely difficult ways.
For example, like this:
userLocation = YMKPoint(latitude: view.pin.geometry.latitude, longitude: view.pin.geometry.longitude)
The waiting time for loading coordinates varies with this approach from 2 to 50 seconds.
“You're wrong, there must be a focused LocationManager,” I told myself. As it turned out later - indeed, such a “friend” is in the documentation ... BUT WHERE IS AN EXAMPLE WITH HIM?!?
In the sample project, there is no example of the application of such a manager:

- Well, documentation, only you and I are left.
- Yes, there are no problems, "innovator", enjoy:

We subscribe the UIViewController to the protocol (I hope there is no need to further explain anything here, well, really, guys):
AND…

1-15 seconds, CARL! fifteen! Sometimes it works out the previous option faster! How is that??
Yandex, what a joke? So much time to spend to try it all, and to get such a result - well, it's generally sad.
I thought, thought ... Well, not really the same. Give a person a controller with cards and put him into a stupor when switching to it for more than 4 seconds - this is suicide for the application. No one will wait more than 5 seconds with full confidence that this is comfortable (if you do not believe me, listen to Vitaliy Fridman's reports on UI / UX).
I thought more ... and the following emotion was this:
Who wants with sound - www.youtube.com/watch?v=pTZaNHZGsQoThe recipe for success was this:
Take a
kilo ... CLLocationManager and YMKLocationManager and ... make them work together.

This joint ... "work" looks something like this:
... and the pilaf is readyThe result of the speed of getting the user's point: a little more than 0 seconds.
The very case when (in my opinion) when solving a trivial problem, the opposition of the native and embedded parts looked like this:

The result of the work visually is as follows:

Summarizing the above:
colleagues, the article is written so that when solving such a problem you do not spend as much time as I spent and either choose a different path or walk it quickly.
I would like to see constructive criticism and / or alternative
correct solutions.
If the article turned out to be useful to you, correct me with a Lois rating and, preferably, check out the
original version of this story in a new way.
All creative success and positive mood!