Sunday, October 2, 2022
HomeiOS Developmentios - XCODE UserTracking with customized Marker

ios – XCODE UserTracking with customized Marker


I’m studying iOS growth I wish to present userTracking mode to comply with with buyer marker. Beneath is how I’ve tried to create marker on map

 @IBOutlet weak var mapKIT: MKMapView!
@objc func labelAction(_ sender: UIGestureRecognizer) {
        //Haptic Engine
        let influence = UIImpactFeedbackGenerator()
        influence.impactOccurred()
        
        let regionDistance:CLLocationDistance = 1000
        let coordinates = CLLocationCoordinate2DMake((latitude)!, (longitude)!)
        let regionSpant = MKCoordinateRegion(heart: coordinates, latitudinalMeters: regionDistance, longitudinalMeters: regionDistance)
        let placeMark = MKPlacemark(coordinate: coordinates, addressDictionary: nil)        
        mapKIT.isZoomEnabled = true
        
        mapKIT.setRegion(regionSpant, animated: true)
        mapKIT.layer.identify = "You're right here"
        if counter == 0{
            mapKIT.mapType = MKMapType.satellite tv for pc
            counter = 1
        }
        if speeds! <= 0.9{
            mapKIT.addAnnotation(placeMark)
            mapKIT.userLocation.title = "You're right here"
        }else{
            mapKIT.showsUserLocation = true
            mapKIT.userTrackingMode = .comply with
        }

And down under is how am getting Person Gps data.

var lastCoordinate:CLLocationCoordinate2D?
var latitude:CLLocationDegrees?
var longitude:CLLocationDegrees?
var muda:Date?
var speeds:Double?
    func locationManager(_ _manager:CLLocationManager, didUpdateLocations Location:[CLLocation]){
            if let location = Location.first{
                coordinate.textual content = "Your location (location.coordinate.latitude.description) (location.coordinate.longitude.description) - (location.timestamp.description) "
                velocity.textual content = "Your transferring at velocity of (location.velocity.description) course (location.courseAccuracy.description)"
                altitude.textual content = "Your at altitude of (location.altitude.description )"
                muda = location.timestamp
    
                latitude = location.coordinate.latitude
                longitude = location.coordinate.longitude
                muda = location.timestamp
                speeds = location.velocity
                
            }

What I need is the marker I’ve create on map to maneuver or to comply with the transferring course in map.For now it is simply create marker far and wide I’ve been.I apologies for my English I’m utilizing google translator

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments