4

I have an image(floor plan) where i pinned my current position. with CMPedometer I am able to find the number of steps moved but couldn't find the direction in which i am moving.

if(CMPedometer.isStepCountingAvailable()){

    self.pedoMeter.startUpdates(from: midnightOfToday) { (data: CMPedometerData?, error) -> Void in

        DispatchQueue.main.async(execute: { () -> Void in
            if(error == nil) {
                self.stepsLabel.text = "Moved \(data!.numberOfSteps) steps"
            }
        })
    }
}

Is there any way of finding the direction i am moving (relevant to my point OR to E,W,S,N ) ?

Stephen
  • 3,359
  • 4
  • 20
  • 30

1 Answers1

0

CMMotionManager provides you API to work with Magnetometer.

It should be use to determine heading (North).

Alex Motor
  • 928
  • 5
  • 20