Skip to main content

Set multiple markers and image on google map swift 3

 let locations = [
                    ["title": "Phase 11, Mohali", "latitude": 30.680177, "longitude": 76.745705],
                    ["title": "Phase 6, Mohali", "latitude": 30.735547, "longitude": 76.712071],
                    ["title": "Phase 106, Mohali", "latitude": 30.728100, "longitude": 76.717665]
                ]
        
                for location in locations {
                    let marker = GMSMarker()
                    marker.position = CLLocationCoordinate2D(latitude: location["latitude"] as! Double, longitude: location["longitude"] as! Double)
                  //  state_marker2.snippet = "Phase 106, Mohali."
                    marker.title = location["title"] as? String
                    //For image
//                    let markerImage = UIImage(named: "Web")!.withRenderingMode(.alwaysTemplate)
//                  let markerView = UIImageView(image: markerImage)
//                   marker.iconView = markerView
                    marker.map = gmsMapViewOut

                }

Comments

Popular posts from this blog

Call phone Number In swift 3

//Here you can make method of calling functionality. func callNumber (yourP honeNumber : String ) { if let phoneCallURL = URL ( string : "tel://\(yourP honeNumber )" ) { let application : UIApplication = UIApplication . shared if ( application . canOpenURL ( phoneCallURL )) { application . open ( phoneCallURL , options : [:], completionHandler : nil ) } } } Happy Coding :)

Create ActionSheet and AlertView in swift 3

let  alertVC:  UIAlertController  = UIAlertController (title:  "Alert" , message:  "YOUR MESSAGE" , preferredStyle: .actiobSheet)    let  okBtn = UIAlertAction. init (title:  "Ok" , style: . default , handler: {  _   in                           // Perform whatever you want                          })     alertVC.addAction(okBtn)     self .present(alertVC, animated:  true , completion:  nil )