From the course: Advanced iOS App Development: MapKit & Core Location
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Challenge 5: Headings and speed - iOS Tutorial
From the course: Advanced iOS App Development: MapKit & Core Location
Challenge 5: Headings and speed
(cymbals crashing) - Besides your coord and altitude, the CLLocation Class has a few more properties which are useful for devices in motion. You can get heading and speed data for your points as well, which we're going to look at in the next challenge. Heading is the direction the device has traveled from the last point to this point. It uses position changes to figure out your heading and places it in a property course. Course is a type CLLocationDirection. It's a value in degrees. It may give a negative value when it can't give a heading, so you may want to watch for that. Speed is type CLLocationSpeed, measured in meters per second. You may need to convert this to a measurement system that makes sense for your app, such as miles per hour, where you multiply by 2.23694, or kilometers per hour, where you multiply by 3.6. Now it's your turn. Make a string that has heading and speed data in miles per hour or kilometers per hour, your choice. Then print that to the console after the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.