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

Preface

Swift, a relatively new computer language created by Apple Computers and its version 2 was already released. This programming language is gradually gaining features, performance, and stability. This book shows you how to create different apps using different frameworks. Thus, after reading this book, you will have a big skill set for Swift development.

What this book covers

Chapter 1, Exploring Xcode, explores some features of Xcode. It gives you some tips on how to debug and develop more quickly.

Chapter 2, Creating a City Information App with Customized Table Views, shows you how to create an app with different scenes and table views, retrieving information from the Internet. Here, you will learn how to use SwiftyJSON, a framework that allows you to work with JSON messages very easily.

Chapter 3, Creating a Photo Sharing App, will show you how to use the camera, edit your photo, and share it with your friends using the social framework.

Chapter 4, Simulating Home Automation with HomeKit, will show you how to simulate a house with its devices, create an app that retrieves your devices' information, and also change their state. This kind of app will be popular very soon due to the popularity of the Internet of Things (IoT).

Chapter 5, Health Analyzing App Using HealthKit, will teach you how to use HealthKit. Here, you are going to do some queries to receive and update the user's health data. You will appreciate a different way of treating the data as it needs to be converted into your favorite unit. Besides this, you will learn a third-party framework called iOS Chart. Here, you will be able to display some charts to the user to check their progress.

Chapter 6, Creating a Game App Using SpriteKit, is a chapter for those who like playing games on their phones. It is even more fun when you learn how to create your game, mainly if it is with SpriteKit, a framework that is very easy to follow and made for developing 2D games. We will develop a game based on a surfer dinosaur that needs to dodge the enemies. To move the character, we will use the accelerometer sensor.

Chapter 7, Creating an Apple Watch App, shows us how to create an app that controls our fridge. We can check our Apple Watch for the amount of food that we still have. This app also helps us display the route on the map to the supermarket.

Chapter 8, AVFoundation, shows how your phone, besides recording videos, can also edit them. Here, we are going to use a low-level framework called AVFoundation to change the audio of an existing video from the photos gallery. To do this app, we will also need some help from the photos framework.

What you need for this book

As you are developing iOS apps, you will need a relatively new Apple computer with OS X Yosemite (10.10) or above, Xcode 6 or above, and for some chapters, a physical Apple mobile device would be needed, because some features are not supported by the simulator. A few cases will require you to be enrolled in the Apple Developer Program due to the requirement of some capabilities. An Internet connection is also required for some chapters.

Who this book is for

You! That's right, if you are an iOS developer and you want to do some real-life examples using the Swift programming language. If you are willing to learn a big variety of iOS frameworks, this is the right book for you, as we are going to develop seven apps using different frameworks.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: " Now it time to develop the viewDidLoad method."

A block of code is set as follows:

class Person{ 
   var name:String
   var age:Int
   init(name: String, age:Int) {
        self.name = name
       self.age = age
   }
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

class Person{ 
   var name:String
   var age:Int
   var address:String
   init(name: String, age:Int) {
        self.name = name
       self.age = age
   }
}

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Clicking the Next button moves you to the next screen."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/Swift_2_Blueprints_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.