Book Image

Swift 2 Blueprints

By : Cecil Costa
Book Image

Swift 2 Blueprints

By: Cecil Costa

Overview of this book

In this book, you will work through seven different projects to get you hands-on with developing amazing applications for iOS devices. We start off with a project that teaches you how to build a utility app using Swift. Moving on, we cover the concepts behind developing an entertainment or social networking related application, for example, a small application that helps you to share images, audio, and video files from one device to another. You’ll also be guided through create a city information app with customized table views, a reminder app for the Apple Watch, and a game app using SpriteKit. By the end of this book, you will have the required skillset to develop various types of iOS applications with Swift that can run on different iOS devices. You will also be well versed with complex techniques that can be used to enhance the performance of your applications.
Table of Contents (15 chapters)
Swift 2 Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Going to the supermarket


Now, it is time to create the last scene of the iOS app. Here, we just need to add a new view controller with a label, map view, table view, and button to the storyboard.

A label is used only to display the scene's title. Therefore, we will set its title to Supermarket Directions and place it at the top of the screen. Then, we will place the map under it to occupy approximately half the screen. Below the map, we will place the table view; here is where will display the directions. Lastly, we will place the button with the Main Menu title. The final layout should be similar to the following screenshot:

Add a new file to your project called MapViewController.swift and import the UIKit, MapKit, and CoreLocation frameworks with the following code:

import UIKit
import MapKit
import CoreLocation

Create the corresponding class by calling it MapViewController, inheriting from UIViewController and implementing the MKMapViewDelegate and UITableViewDataSource protocols:

class MapViewController...