@@ -11,7 +11,6 @@ final class MeridianMapContainer: UIView {
1111 private( set) var mapVC : MRMapViewController ?
1212 private let logTag = " MerMapsss "
1313
14- // Find nearest parent view controller to properly embed MRMapViewController
1514 private func findParentViewController( ) -> UIViewController ? {
1615 var responder : UIResponder ? = self
1716 while let current = responder {
@@ -35,51 +34,41 @@ final class MeridianMapContainer: UIView {
3534 super. layoutSubviews ( )
3635 if let vcView = mapVC? . view {
3736 vcView. frame = bounds
38- NSLog ( " %@: layoutSubviews mapVC.view=%@ bounds=%@ " , logTag, NSCoder . string ( for: vcView. frame) , NSCoder . string ( for: bounds) )
39- } else {
40- NSLog ( " %@: layoutSubviews mapVC.view=nil bounds=%@ " , logTag, NSCoder . string ( for: bounds) )
4137 }
4238 }
4339
4440 override func didMoveToWindow( ) {
4541 super. didMoveToWindow ( )
46- NSLog ( " %@: didMoveToWindow window?=%@ bounds=%@ " , logTag, window != nil ? " yes " : " no " , NSCoder . string ( for: bounds) )
4742 if window != nil {
4843 tryConfigure ( )
4944 }
5045 }
5146
5247 private func tryConfigure( ) {
5348 if mapVC != nil {
54- NSLog ( " %@: tryConfigure: already has mapVC " , logTag)
5549 return
5650 }
5751 guard let appId = appId, let mapId = mapId, let appToken = appToken else {
58- NSLog ( " %@: tryConfigure: missing props appId=%@ mapId=%@ token?=%@ " , logTag, String ( describing: self . appId) , String ( describing: self . mapId) , self . appToken != nil ? " yes " : " no " )
5952 return
6053 }
61- NSLog ( " %@: tryConfigure: appId=%@ mapId=%@ token=%@ size=%@ window?=%@ " , logTag, appId, mapId, ( appToken as NSString ) . substring ( to: min ( 8 , appToken. count) ) , NSCoder . string ( for: bounds) , window != nil ? " yes " : " no " )
6254
6355 let cfg = MRConfig ( )
6456 cfg. applicationToken = appToken
6557 Meridian . configure ( cfg)
66- NSLog ( " %@: Meridian.configure done " , logTag)
6758
6859 let mapKey = MREditorKey ( forMap: mapId, app: appId)
6960 let vc = MRMapViewController ( )
7061 vc. mapView. mapKey = mapKey
71- // Configure search sheet immediately upon controller creation
62+
7263 vc. displaysSearchSheet ( true ,
7364 withQuickSearchPlacemarks: [
7465 MRDMapIconType . ATM. rawValue,
7566 MRDMapIconType . waterFountain. rawValue
7667 ] ,
7768 hideDefaultQuickSearchIcons: false )
78- // vc.displaysSearchSheet = true
7969 self . mapVC = vc
8070
8171 guard let childView = vc. view else {
82- NSLog ( " %@: mapVC.view is nil after init " , logTag)
8372 return
8473 }
8574 childView. frame = bounds
@@ -88,30 +77,11 @@ final class MeridianMapContainer: UIView {
8877 childView. alpha = 1
8978
9079 attachController ( vc, childView: childView)
91-
92- // Ensure presentation after attachment
93- DispatchQueue . main. async { [ weak vc] in
94- vc? . displaysSearchSheet ( true ,
95- withQuickSearchPlacemarks: [
96- MRDMapIconType . ATM. rawValue,
97- MRDMapIconType . waterFountain. rawValue
98- ] ,
99- hideDefaultQuickSearchIcons: false )
100- }
101- DispatchQueue . main. asyncAfter ( deadline: . now( ) + 2.0 ) { [ weak vc] in
102- vc? . displaysSearchSheet ( true ,
103- withQuickSearchPlacemarks: [
104- MRDMapIconType . ATM. rawValue,
105- MRDMapIconType . waterFountain. rawValue
106- ] ,
107- hideDefaultQuickSearchIcons: false )
108- }
10980 }
11081}
11182
11283private extension MeridianMapContainer {
11384 func attachController( _ vc: MRMapViewController , childView: UIView ) {
114- // Ensure we only attach to the actual parent view controller that owns this view
11585 if let parent = findParentViewController ( ) {
11686 parent. addChild ( vc)
11787 addSubview ( childView)
@@ -120,7 +90,6 @@ private extension MeridianMapContainer {
12090 return
12191 }
12292
123- // Parent not ready yet, retry shortly on the next runloop tick
12493 NSLog ( " %@: parent VC not ready, retrying attach... " , logTag)
12594 DispatchQueue . main. asyncAfter ( deadline: . now( ) + 0.05 ) { [ weak self] in
12695 guard let self = self , let currentVC = self . mapVC, let currentView = currentVC. view else { return }
0 commit comments