I have UIViewController with GMSMapView (connected from storyboard) like this
@IBOutlet weak var map: GMSMapView!
in
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
self.map.delegate = nil
self.map.clear()
self.map.removeFromSuperview()
self.map = nil
}
and also I have
deinit {print "DEINIT ME"}
Deinit works - I see print message.
I have to load and unload this viewcontroller many times during app works. Dismiss - this is presented view controller. And each time I use it - in memory adds new GMSMapView. Ten times I use controller - ten GMSMapView objects will be in memory graph and so this connect with huge memory leak.
How can I unload GMSMapView from memory when I dismiss this viewcontroller?