How to load icon image from server in google maps in swift5?

Viewed 29

I am working with Google maps. this is my MapModel

struct MapModel: Codable {
    let iconUrl: String
    let xCoordinate: Double
    let yCoordinate: Double
}

I have- let marker = GMSMarker() I want to set marker.icon from server using my model. For loading image I use this extension.

extension UIImageView {
    func load(str: String) {
        let url = URL(string: str)
        if let url = url {
            self.load.request(with: url)
        } else {
            self.load(str: "imp.png")
        }
    }
}

But marker.icon is Uiimage type and this extension is for UIImageview. How can I get marker.icon?

0 Answers
Related