{"action":"created","issue":{"url":"https://api.github.com/repos/googlemaps/google-maps-ios-utils/issues/188","repository_url":"https://api.github.com/repos/googlemaps/google-maps-ios-utils","labels_url":"https://api.github.com/repos/googlemaps/google-maps-ios-utils/issues/188/labels{/name}","comments_url":"https://api.github.com/repos/googlemaps/google-maps-ios-utils/issues/188/comments","events_url":"https://api.github.com/repos/googlemaps/google-maps-ios-utils/issues/188/events","html_url":"https://github.com/googlemaps/google-maps-ios-utils/issues/188","id":324641891,"node_id":"MDU6SXNzdWUzMjQ2NDE4OTE=","number":188,"title":"No custom images for marker items if GMUDefaultClusterRenderer delegate is class instance","user":{"login":"fongd","id":241671,"node_id":"MDQ6VXNlcjI0MTY3MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/241671?v=4","gravatar_id":"","url":"https://api.github.com/users/fongd","html_url":"https://github.com/fongd","followers_url":"https://api.github.com/users/fongd/followers","following_url":"https://api.github.com/users/fongd/following{/other_user}","gists_url":"https://api.github.com/users/fongd/gists{/gist_id}","starred_url":"https://api.github.com/users/fongd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fongd/subscriptions","organizations_url":"https://api.github.com/users/fongd/orgs","repos_url":"https://api.github.com/users/fongd/repos","events_url":"https://api.github.com/users/fongd/events{/privacy}","received_events_url":"https://api.github.com/users/fongd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-19T16:28:59Z","updated_at":"2018-06-27T22:53:35Z","closed_at":null,"author_association":"NONE","body":"Not sure how to phrase this issue, but hopefully this makes sense. I'm using Swift 4.1, Xcode 9.3.1, Google Maps installed as a CocoaPod, google-maps-ios-utils installed following the instructions here: https://github.com/googlemaps/google-maps-ios-utils/blob/master/Swift.md\r\n\r\nI'm trying to customize the marker items by creating a custom cluster renderer using something like this:\r\n\r\n```\r\nclass CustomClusterRenderer: NSObject, GMUClusterRendererDelegate {\r\n    func renderer(_ renderer: GMUClusterRenderer, willRenderMarker marker: GMSMarker) {\r\n        if let userData = marker.userData {\r\n            print(userData)\r\n        }\r\n        guard let _ = marker.userData as? POIItem else { return }\r\n\r\n        if let image = UIImage(named: \"marker\") {\r\n            marker.iconView = UIImageView(image: image, highlightedImage: nil)\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nIn my view controller's viewDidLoad, I create an instance of this class and assign it as the `GMUDefaultClusterRenderer` delegate:\r\n\r\n```\r\nlet renderer = GMUDefaultClusterRenderer(mapView: map, clusterIconGenerator: iconGenerator)\r\nlet customClusterRenderer = CustomClusterRenderer()\r\nrenderer.delegate = customClusterRenderer\r\n```\r\n\r\nWhen I run this, I still get the default marker images instead of my custom marker pin.\r\n\r\nHowever, if I instead modify my view controller to extend `GMUClusterRendererDelegate` and implement `renderer(_ renderer: GMUClusterRenderer, willRenderMarker marker: GMSMarker)` in there like so:\r\n\r\n```\r\nclass ViewController: UIViewController, GMUClusterRendererDelegate {\r\n    override func viewDidLoad() {\r\n        super.viewDidLoad()\r\n        …\r\n        let renderer = GMUDefaultClusterRenderer(mapView: map, clusterIconGenerator: iconGenerator)\r\n        renderer.delegate = self\r\n    }\r\n\r\n    func renderer(_ renderer: GMUClusterRenderer, willRenderMarker marker: GMSMarker) {\r\n        if let userData = marker.userData {\r\n            print(userData)\r\n        }\r\n        guard let _ = marker.userData as? POIItem else { return }\r\n        \r\n        if let image = UIImage(named: \"marker\") {\r\n            marker.iconView = UIImageView(image: image, highlightedImage: nil)\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nThen the marker icons are properly customized as I want them.\r\n\r\nIs there something I'm doing wrong here or do I need to implement some additional steps when I try to use an instance as GMUDefaultClusterRenderer's delegate? I originally wanted to create a separate delegate class to create a cleaner separation but I'm willing to just extend ViewController if it's easier.\r\n"},"comment":{"url":"https://api.github.com/repos/googlemaps/google-maps-ios-utils/issues/comments/400854688","html_url":"https://github.com/googlemaps/google-maps-ios-utils/issues/188#issuecomment-400854688","issue_url":"https://api.github.com/repos/googlemaps/google-maps-ios-utils/issues/188","id":400854688,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMDg1NDY4OA==","user":{"login":"breakline87","id":7821133,"node_id":"MDQ6VXNlcjc4MjExMzM=","avatar_url":"https://avatars2.githubusercontent.com/u/7821133?v=4","gravatar_id":"","url":"https://api.github.com/users/breakline87","html_url":"https://github.com/breakline87","followers_url":"https://api.github.com/users/breakline87/followers","following_url":"https://api.github.com/users/breakline87/following{/other_user}","gists_url":"https://api.github.com/users/breakline87/gists{/gist_id}","starred_url":"https://api.github.com/users/breakline87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/breakline87/subscriptions","organizations_url":"https://api.github.com/users/breakline87/orgs","repos_url":"https://api.github.com/users/breakline87/repos","events_url":"https://api.github.com/users/breakline87/events{/privacy}","received_events_url":"https://api.github.com/users/breakline87/received_events","type":"User","site_admin":false},"created_at":"2018-06-27T22:53:35Z","updated_at":"2018-06-27T22:53:35Z","author_association":"NONE","body":"Can you guys please update the documentation and provide samples on how to set custom images for both the cluster images and markers? At the moment it's rather lacking"}}
{"actor":{"display_login":"breakline87"}}