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

post method using alamofire in swift 3

  func addSubscriptionApi(_completeUrl: String ) {         //HUD         Alamofire.request(_completeUrl, method:.post, parameters: nil , encoding: JSONEncoding. default , headers: nil ).responseJSON { response in             switch (response.result) {             case .success( _ ):                 if let data = response.result.value as ? NSDictionary                 {                     print(response.result.value as Any)                     print(data)                      print("SUCCESS")                  }                 break  ...

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 :)