Implementing the Distance Screen

Add a new Cocoa Touch class to the project, call it DistanceViewController, and make it a subclass of UIViewController.

Open Main.storyboard and drag a view controller from the library (L) to the storyboard. Select the new view controller in the structure area and open the identity inspector using the shortcut 4. Set the class of the view controller to DistanceViewController. Next, open the attributes inspector with the shortcut 5 and select the check box for Is Initial View Controller. With this change, iOS shows an instance of this view controller when the app launches.

We want to show the distance in meters in a label. Drag a UILabel from the library to the scene of the DistanceViewController

Get Build Location-Based Projects for iOS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.