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

Recording


The first scene was created to let the user choose the video that he/she wanted to edit. Now, we have to create another scene where the user will watch the movie while recording his/her narrative over it.

Add a new file called RecorderViewController.swift to your project and import UIKit, AVFoundation, and Photos, as shown in the following code:

import UIKit
import AVFoundation
import Photos

Create a class called RecorderViewController, which inherits from UIViewController and implements the AVAudioRecorderDelegate protocol with the following code:

class RecorderViewController: UIViewController, AVAudioRecorderDelegate {

This scene will have only a view, where the user will watch the movie, and a button to record the audio. Based on this information, we are going to add UIView and UIButton as attributes. Place the following code to add the needed UI attributes:

    @IBOutlet weak var videoView: UIView!
    @IBOutlet weak var recordButton: UIButton!

This class still needs more attributes...