peter peter - 7 months ago 92
Swift Question

Swift Google map delegates are not working

I have a view containing a few google maps functions but for some odd reason the the "info window tapped " and "marker did tapped" doesn't do anything. Im not sure what Im missing. I have other extenstions in a few different files but i don't think that should cause any issues.

import UIKit
import Firebase
import FirebaseDatabase
import FirebaseAuth
import CoreLocation
import GoogleMaps
import Font_Awesome_Swift

class DasboardVC: UIViewController, CLLocationManagerDelegate, GMSMapViewDelegate {

@IBAction func unwindSegueDashboard(segue:UIStoryboardSegue){}

//var sidebar items

@IBOutlet weak var mapView: GMSMapView!
@IBOutlet weak var addPhotoLabel: UILabel!
@IBOutlet weak var showSideBar: UIButton!
@IBOutlet weak var hideMenuIcon: UIButton!
@IBOutlet weak var profileImage: UIImageView!
@IBOutlet weak var editProfileButon: UIButton!
@IBOutlet weak var message: UIButton!
@IBOutlet weak var settings: UIButton!
@IBOutlet weak var logout: UIButton!
@IBOutlet weak var sidebarView: UIView!
@IBOutlet weak var activityButton: UIButton!
@IBOutlet weak var jobRequestSwitch: UISwitch!
@IBOutlet weak var topBar: UIView!
@IBOutlet weak var removePhoto: UIButton!

let profileImageController = ProfileImageVC()
let photoController = ProfilePicClass()

//MapView Vars
var locationManager = CLLocationManager()
var didFindMyLocation = false
var locationMarker: GMSMarker!

override func viewWillAppear(animated: Bool) {

sidebarView.hidden = true
removePhoto.hidden = true
topBar.backgroundColor = main()

// sidebarProfileImage()
photoController.profileImage(profileImage, noImageLabel: addPhotoLabel)

override func viewWillDisappear(animated: Bool) {


override func viewDidLoad() {


mapView.addObserver(self, forKeyPath: "myLocation", options: NSKeyValueObservingOptions.New, context: nil)

mapView.myLocationEnabled = true
mapView.settings.myLocationButton = true

let ihelprCoordinate:CLLocationCoordinate2D = CLLocationCoordinate2DMake(37.332052, -122.031088)



func mapView(mapView: GMSMapView, didTapInfoWindowOfMarker marker: GMSMarker) {

func mapView(mapView: GMSMapView, didTapMarker marker: GMSMarker) -> Bool {

return true



Try adding mapView.delegate = self in the viewDidLoad() method