{"id":371554,"date":"2024-05-21T04:51:29","date_gmt":"2024-05-21T04:51:29","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=371554"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-21T04:51:29","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=371554","title":{"rendered":"<span>YandexMapKit \u0438 SwiftUI: \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0433\u0435\u043e\u043a\u043e\u0434\u0438\u043d\u0433<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0414\u0430\u043d\u043e<\/h2>\n<ul>\n<li>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434 IOS \u0434\u043b\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0430\u0432\u0442\u043e\u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430<\/p>\n<\/li>\n<li>\n<p>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f IOS &#8212; 15.5, SwiftUI<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 YandexMapKit \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0435\u0439 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e API \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c GRPC<\/p>\n<\/li>\n<\/ul>\n<h2>\u0426\u0435\u043b\u044c<\/h2>\n<ul>\n<li>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u0435\u0437\u0434\u043e\u043a \u0441 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u043d\u0430\u0447\u0430\u043b\u0430 \u0438 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0433\u0435\u043e\u043a\u043e\u0434\u0438\u043d\u0433 (\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u043c \u0433\u0435\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c) \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u0447\u0442\u043e \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u043b\u0435\u043d\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f YandexMapKit<\/p>\n<\/li>\n<\/ul>\n<h2>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/h2>\n<p>\u042f \u043d\u0435 \u0441\u0442\u0430\u043d\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f YandexMapKit \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u044d\u0442\u043e \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e, \u0430 \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0439 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"https:\/\/yandex.ru\/dev\/mapkit\/doc\/ru\/ios\/generated\/getting_started\" rel=\"noopener noreferrer nofollow\">YandexMapKit SDK<\/a>.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0445\u043e\u0447\u0443 &#171;\u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c\u0441\u044f&#187;, \u0447\u0442\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0437-\u0437\u0430 \u043a\u0430\u0440\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u042f\u043d\u0434\u0435\u043a\u0441\u0430 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0430\u0447\u0430\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c CocoaPods, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u0435\u043d\u0434\u043e\u0440 (\u043f\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u043d\u0430 \u043c\u0430\u0440\u0442 2024 \u0433\u043e\u0434\u0430) \u043d\u0435 \u0441\u043d\u0438\u0437\u043e\u0448\u0435\u043b \u0434\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043c\u0438\u043d\u0443\u044f Pods.<\/p>\n<h2>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0439 \u0446\u0435\u043b\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043a\u043b\u0430\u0441\u0441 GeoCoder \u0438 \u0435\u0433\u043e \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u0434\u043b\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<pre><code class=\"swift\">import SwiftUI import Combine import YandexMapsMobile  final class GeoCoder: ObservableObject {     static let shared = GeoCoder()        \/\/ MARK: - Variables     private lazy var searchManager = YMKSearch.sharedInstance().createSearchManager(with: .online)     private var searchSession: YMKSearchSession?     private var searchSessions: [YMKSearchSession] = []    ... }<\/code><\/pre>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 \u0433\u0435\u043e\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0435\u0439 YandexMapKit, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0433\u0435\u043e\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b \u043a\u044d\u0448. \u0421\u043f\u043e\u0441\u043e\u0431 \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u0430\u043c\u0438. \u0412\u0432\u0438\u0434\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043a\u044d\u0448\u0430 \u044f \u0438\u0437\u0431\u0440\u0430\u043b \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 &#8212; @AppStorage<\/p>\n<pre><code class=\"swift\">  \/\/ \u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043a\u044d\u0448\u0430   @AppStorage(\"geoCache\")  var geoCache: [String: String] = [:]<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0434\u043b\u044f  \u0440\u0430\u0431\u043e\u0442\u044b <code>Dictionary[String: String]<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c extension:<\/p>\n<pre><code class=\"swift\">extension Dictionary: RawRepresentable where Key == String, Value == String {     public init?(rawValue: String) {         guard let data = rawValue.data(using: .utf8),               let result = try? JSONDecoder().decode([String:String].self, from: data)         else {             return nil         }         self = result     }          public var rawValue: String {         guard let data = try? JSONEncoder().encode(self),               let result = String(data: data, encoding: .utf8)         else {             return \"{}\"  \/\/ \u043f\u0443\u0441\u0442\u043e\u0439 Dictionary \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u0430\u043a String         }         return result     }      }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0430\u043c \u043c\u0435\u0442\u043e\u0434. <br \/><em>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0434\u043b\u044f \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <\/em><code>writeLog (_ logText: String, logLevel: OSLogType = .default)<\/code><em>, \u0440\u0430\u0431\u043e\u0442\u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443. \u0422\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f OSLog \u0438 Crashlytics \u043e\u0442 Google. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/em><\/p>\n<pre><code class=\"swift\">\/\/ MARK: - Methods     func submitSearch(with point: YMKPoint, completion: @escaping () -> Void) {         \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u044d\u0448         if let address = self.geoCache[\"\\(point.latitude)_\\(point.longitude)\"] {             writeLog(\"GeoCoder->submitSearch(): Already cached \\(address)\")             completion()         } else {             \/\/\u0432 \u043a\u044d\u0448\u0435 \u0442\u043e\u0447\u043a\u0443 \u043d\u0435 \u043d\u0430\u0448\u043b\u0438, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0433\u0435\u043e\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435             let searchSession = searchManager.submit(                 with: point,                 zoom: 16,                 searchOptions: YMKSearchOptions(),                 responseHandler:  { response, error in                     \/\/ \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a                                    if let error = error {                         writeLog(\"GeoCoder->submitSearch(): ERROR \\(error.localizedDescription)\", logLevel: .error)                         completion()                     }                     \/\/\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430                     guard let response = response else {                         return completion()                     }                                          if let obj = response.collection.children.first?.obj?.metadataContainer.getItemOf(YMKSearchToponymObjectMetadata.self) {                         let object = obj as! YMKSearchToponymObjectMetadata                         \/\/ \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0434\u0430\u043d\u044b\u0435 \u0432 \u043a\u044d\u0448\u0435.                          self.geoCache[\"\\(point.latitude)_\\(point.longitude)\"] = object.address.formattedAddress                         writeLog(\"GeoCoder->submitSearch(): SUCCESS \\(object.address.formattedAddress)\")                         completion()                     }                 }             )             searchSessions.append(searchSession)         }     }<\/code><\/pre>\n<h2>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430<\/p>\n<pre><code class=\"swift\">@ObservedObject var geoCoder = GeoCoder.shared<\/code><\/pre>\n<p>\u0418 \u043f\u0440\u043e &#171;\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435&#187; \u0435\u0433\u043e \u0432 Struct, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u043f\u043e\u0435\u0437\u0434\u043a\u0438:<\/p>\n<pre><code class=\"swift\">import SwiftUI import Kingfisher import SwiftProtobuf import YandexMapsMobile struct TrackView: View {   @StateObject var geoCoder = GeoCoder.shared   @State var track: API_V1_TrackInfo   @State var startAddress: String   @State var endAddress: String   init(track: API_V1_TrackInfo) {         self.track = track         self.startAddress = \"\\( String(track.beginPoint.latitude)), \\(String(track.beginPoint.longitude))\"         self.endAddress = \"\\( String(track.endPoint.latitude)), \\(String(track.endPoint.longitude))\"   }   var body: some View {          ...          LazyVStack {       VStack(alignment: .leading){           Text(\"\\(track.begin.toLocaTimetring()) - \\(startAddress)\")               .frame(maxWidth: .infinity, alignment: .leading)               .multilineTextAlignment(TextAlignment.leading)           Spacer()           Text(\"\\(track.end.toLocaTimetring()) - \\(endAddress)\")               .frame(maxWidth: .infinity, alignment: .leading)               .multilineTextAlignment(TextAlignment.leading)                  }       .onAppear{           let beginPoint = YMKPoint(latitude: track.beginPoint.latitude, longitude: track.beginPoint.longitude)           let endPoint = YMKPoint(latitude: track.endPoint.latitude, longitude: track.endPoint.longitude)           geoCoder.submitSearch(with: beginPoint , completion: {               if let address = geoCoder.geoCache[\"\\(beginPoint.latitude)_\\(beginPoint.longitude)\"] {                   self.startAddress = address                                  }                          })           geoCoder.submitSearch(with: endPoint , completion: {               if let address = geoCoder.geoCache[\"\\(endPoint.latitude)_\\(endPoint.longitude)\"] {                   self.endAddress = address               }           })       }       .frame(maxWidth: .infinity)       .padding(0)   }.padding(0)          ...        } }<\/code><\/pre>\n<h2>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h2>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d5a\/b8e\/c89\/d5ab8ec89a74453976c4d9d167c55ba7.png\" alt=\"\u041f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438 \u043f\u043e \u043c\u0435\u0440\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438\" title=\"\u041f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438 \u043f\u043e \u043c\u0435\u0440\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438\" width=\"383\" height=\"124\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d5a\/b8e\/c89\/d5ab8ec89a74453976c4d9d167c55ba7.png\"\/><\/p>\n<div><figcaption>\u041f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438 \u043f\u043e \u043c\u0435\u0440\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/figcaption><\/div>\n<\/figure>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043b\u043e\u0433\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/dac\/05c\/947\/dac05c9478d62349fea03db64a8db26d.png\" alt=\"\u0427\u0430\u0441\u0442\u044c \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u043a\u044d\u0448\u0435, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0433\u0435\u043e\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c\" title=\"\u0427\u0430\u0441\u0442\u044c \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u043a\u044d\u0448\u0435, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0433\u0435\u043e\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c\" width=\"946\" height=\"157\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dac\/05c\/947\/dac05c9478d62349fea03db64a8db26d.png\"\/><\/p>\n<div><figcaption>\u0427\u0430\u0441\u0442\u044c \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u043a\u044d\u0448\u0435, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0433\u0435\u043e\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c<\/figcaption><\/div>\n<\/figure>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0430\u0434\u0440\u0435\u0441\u0430 \u043e\u0442 \u042f\u043d\u0434\u0435\u043a\u0441\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u043d\u0430 \u0442\u043e\u043c \u044f\u0437\u044b\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/802227\/\"> https:\/\/habr.com\/ru\/articles\/802227\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0414\u0430\u043d\u043e<\/h2>\n<ul>\n<li>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434 IOS \u0434\u043b\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0430\u0432\u0442\u043e\u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430<\/p>\n<\/li>\n<li>\n<p>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f IOS &#8212; 15.5, SwiftUI<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 YandexMapKit \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0435\u0439 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e API \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c GRPC<\/p>\n<\/li>\n<\/ul>\n<h2>\u0426\u0435\u043b\u044c<\/h2>\n<ul>\n<li>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u0435\u0437\u0434\u043e\u043a \u0441 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u043d\u0430\u0447\u0430\u043b\u0430 \u0438 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0433\u0435\u043e\u043a\u043e\u0434\u0438\u043d\u0433 (\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u043c \u0433\u0435\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c) \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u0447\u0442\u043e \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u043b\u0435\u043d\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f YandexMapKit<\/p>\n<\/li>\n<\/ul>\n<h2>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/h2>\n<p>\u042f \u043d\u0435 \u0441\u0442\u0430\u043d\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f YandexMapKit \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u044d\u0442\u043e \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e, \u0430 \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0439 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"https:\/\/yandex.ru\/dev\/mapkit\/doc\/ru\/ios\/generated\/getting_started\" rel=\"noopener noreferrer nofollow\">YandexMapKit SDK<\/a>.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0445\u043e\u0447\u0443 &#171;\u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c\u0441\u044f&#187;, \u0447\u0442\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0437-\u0437\u0430 \u043a\u0430\u0440\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u042f\u043d\u0434\u0435\u043a\u0441\u0430 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0430\u0447\u0430\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c CocoaPods, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u0435\u043d\u0434\u043e\u0440 (\u043f\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u043d\u0430 \u043c\u0430\u0440\u0442 2024 \u0433\u043e\u0434\u0430) \u043d\u0435 \u0441\u043d\u0438\u0437\u043e\u0448\u0435\u043b \u0434\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043c\u0438\u043d\u0443\u044f Pods.<\/p>\n<h2>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0439 \u0446\u0435\u043b\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043a\u043b\u0430\u0441\u0441 GeoCoder \u0438 \u0435\u0433\u043e \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u0434\u043b\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<pre><code class=\"swift\">import SwiftUI import Combine import YandexMapsMobile  final class GeoCoder: ObservableObject {     static let shared = GeoCoder()        \/\/ MARK: - Variables     private lazy var searchManager = YMKSearch.sharedInstance().createSearchManager(with: .online)     private var searchSession: YMKSearchSession?     private var searchSessions: [YMKSearchSession] = []    ... }<\/code><\/pre>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 \u0433\u0435\u043e\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0435\u0439 YandexMapKit, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0433\u0435\u043e\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b \u043a\u044d\u0448. \u0421\u043f\u043e\u0441\u043e\u0431 \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u0430\u043c\u0438. \u0412\u0432\u0438\u0434\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043a\u044d\u0448\u0430 \u044f \u0438\u0437\u0431\u0440\u0430\u043b \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 &#8212; @AppStorage<\/p>\n<pre><code class=\"swift\">  \/\/ \u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043a\u044d\u0448\u0430   @AppStorage(\"geoCache\")  var geoCache: [String: String] = [:]<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0434\u043b\u044f  \u0440\u0430\u0431\u043e\u0442\u044b <code>Dictionary[String: String]<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c extension:<\/p>\n<pre><code class=\"swift\">extension Dictionary: RawRepresentable where Key == String, Value == String {     public init?(rawValue: String) {         guard let data = rawValue.data(using: .utf8),               let result = try? JSONDecoder().decode([String:String].self, from: data)         else {             return nil         }         self = result     }          public var rawValue: String {         guard let data = try? JSONEncoder().encode(self),               let result = String(data: data, encoding: .utf8)         else {             return \"{}\"  \/\/ \u043f\u0443\u0441\u0442\u043e\u0439 Dictionary \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u0430\u043a String         }         return result     }      }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0430\u043c \u043c\u0435\u0442\u043e\u0434. <br \/><em>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0434\u043b\u044f \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <\/em><code>writeLog (_ logText: String, logLevel: OSLogType = .default)<\/code><em>, \u0440\u0430\u0431\u043e\u0442\u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443. \u0422\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f OSLog \u0438 Crashlytics \u043e\u0442 Google. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/em><\/p>\n<pre><code class=\"swift\">\/\/ MARK: - Methods     func submitSearch(with point: YMKPoint, completion: @escaping () -> Void) {         \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u044d\u0448         if let address = self.geoCache[\"\\(point.latitude)_\\(point.longitude)\"] {             writeLog(\"GeoCoder->submitSearch(): Already cached \\(address)\")             completion()         } else {             \/\/\u0432 \u043a\u044d\u0448\u0435 \u0442\u043e\u0447\u043a\u0443 \u043d\u0435 \u043d\u0430\u0448\u043b\u0438, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0433\u0435\u043e\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435             let searchSession = searchManager.submit(                 with: point,                 zoom: 16,                 searchOptions: YMKSearchOptions(),                 responseHandler:  { response, error in                     \/\/ \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a                                    if let error = error {                         writeLog(\"GeoCoder->submitSearch(): ERROR \\(error.localizedDescription)\", logLevel: .error)                         completion()                     }                     \/\/\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430                     guard let response = response else {                         return completion()                     }                                          if let obj = response.collection.children.first?.obj?.metadataContainer.getItemOf(YMKSearchToponymObjectMetadata.self) {                         let object = obj as! YMKSearchToponymObjectMetadata                         \/\/ \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0434\u0430\u043d\u044b\u0435 \u0432 \u043a\u044d\u0448\u0435.                          self.geoCache[\"\\(point.latitude)_\\(point.longitude)\"] = object.address.formattedAddress                         writeLog(\"GeoCoder->submitSearch(): SUCCESS \\(object.address.formattedAddress)\")                         completion()                     }                 }             )             searchSessions.append(searchSession)         }     }<\/code><\/pre>\n<h2>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430<\/p>\n<pre><code class=\"swift\">@ObservedObject var geoCoder = GeoCoder.shared<\/code><\/pre>\n<p>\u0418 \u043f\u0440\u043e &#171;\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435&#187; \u0435\u0433\u043e \u0432 Struct, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u043f\u043e\u0435\u0437\u0434\u043a\u0438:<\/p>\n<pre><code class=\"swift\">import SwiftUI import Kingfisher import SwiftProtobuf import YandexMapsMobile struct TrackView: View {   @StateObject var geoCoder = GeoCoder.shared   @State var track: API_V1_TrackInfo   @State var startAddress: String   @State var endAddress: String   init(track: API_V1_TrackInfo) {         self.track = track         self.startAddress = \"\\( String(track.beginPoint.latitude)), \\(String(track.beginPoint.longitude))\"         self.endAddress = \"\\( String(track.endPoint.latitude)), \\(String(track.endPoint.longitude))\"   }   var body: some View {          ...          LazyVStack {       VStack(alignment: .leading){           Text(\"\\(track.begin.toLocaTimetring()) - \\(startAddress)\")               .frame(maxWidth: .infinity, alignment: .leading)               .multilineTextAlignment(TextAlignment.leading)           Spacer()           Text(\"\\(track.end.toLocaTimetring()) - \\(endAddress)\")               .frame(maxWidth: .infinity, alignment: .leading)               .multilineTextAlignment(TextAlignment.leading)                  }       .onAppear{           let beginPoint = YMKPoint(latitude: track.beginPoint.latitude, longitude: track.beginPoint.longitude)           let endPoint = YMKPoint(latitude: track.endPoint.latitude, longitude: track.endPoint.longitude)           geoCoder.submitSearch(with: beginPoint , completion: {               if let address = geoCoder.geoCache[\"\\(beginPoint.latitude)_\\(beginPoint.longitude)\"] {                   self.startAddress = address                                  }                          })           geoCoder.submitSearch(with: endPoint , completion: {               if let address = geoCoder.geoCache[\"\\(endPoint.latitude)_\\(endPoint.longitude)\"] {                   self.endAddress = address               }           })       }       .frame(maxWidth: .infinity)       .padding(0)   }.padding(0)          ...        } }<\/code><\/pre>\n<h2>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h2>\n<figure class=\"\">\n<div><figcaption>\u041f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441\u0430\u043c\u0438 \u043f\u043e \u043c\u0435\u0440\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/figcaption><\/div>\n<\/figure>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043b\u043e\u0433\u0435:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0427\u0430\u0441\u0442\u044c \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u043a\u044d\u0448\u0435, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0433\u0435\u043e\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c<\/figcaption><\/div>\n<\/figure>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0430\u0434\u0440\u0435\u0441\u0430 \u043e\u0442 \u042f\u043d\u0434\u0435\u043a\u0441\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u043d\u0430 \u0442\u043e\u043c \u044f\u0437\u044b\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/802227\/\"> https:\/\/habr.com\/ru\/articles\/802227\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-371554","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/371554","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=371554"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/371554\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=371554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=371554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=371554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}