Check out example codes for "convert meter to miles swift". It will help you in understanding the concepts better.

Code Example 1

extension CGFloat {  
  func getMiles() -> CGFloat{
       return self * 0.000621371192
  }
  function getMeters() -> CGFloat {
       return self * 1609.344
  }
}

Learn ReactJs, React Native from akashmittal.com