Book Image

Application Development with Swift

By : Hossam Ghareeb
Book Image

Application Development with Swift

By: Hossam Ghareeb

Overview of this book

Table of Contents (14 chapters)


This book teaches you how to master the Swift programming language and use it in building apps with the new technologies introduced in iOS 8. Swift is a new programming language for iOS, OS X, and watchOS apps. In the beginning of this book, we will give you an advanced introduction to Swift, and then we will see how to apply this in real-app demos using the new technologies and APIs in iOS 8 such as TouchID, watchOS, Metal, and HealthKit.

What this book covers

Chapter 1, Hello Swift, gives a quick introduction and revision about Swift. This chapter is very important for Swift beginners and is highly recommended for Swift developers to revise their knowledge.

Chapter 2, Advanced Swift, boosts your Swift experience by allowing you to learn some advanced features in Swift. In this chapter, we will talk about protocols, extensions, and memory management.

Chapter 3, Touch ID, gives your app a new flavor of authentication using Touch ID. Users can now use their fingerprint to sign in to your app without needing to write their username and password.

Chapter 4, Introduction to HealthKit, teaches you how to work with HealthKit and how to share or read health data in the native Health app. If you have any apps or ideas about health or fitness, you should give this chapter a shot.

Chapter 5, Introduction to Metal, introduces a cutting edge technology for 3D GPU-accelerated graphics in iOS.

Chapter 6, Introduction to WatchKit, introduces a new device for you—the Apple watch. You will learn all the new technologies needed to build apps for the Apple watch and get your app prepared to exist on users wrists.

Chapter 7, Swift App Extensions, teaches you how to let your users use the app even if your app is not open, using app extensions. App extensions let you extend your app's functionality outside your app and users can access it using system or third-party apps.

What you need for this book

To work on this book, some programming experience is expected. Having experience with Objective-C and iOS development will help you a lot while working with this book. You will also need a Mac OS with Xcode 6+ installed.

Who this book is for

If you are an iOS developer with experience in Objective-C, and wish to develop applications with Swift, then this book is ideal for you. Familiarity with the fundamentals of Swift is an added advantage but not a necessity.


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: "In Swift, you use var for variables, and let for constants."

A block of code is set as follows:

var count = 5
var msg : String
var total : Double = 0

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

Protocol <protocol1, protocol2,…>

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: "Xcode helps you with this by providing the history button in the results sidebar, on the line of the number of times."


Warnings or important notes appear in a box like this.


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

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 for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.


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, 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 and enter the name of the book in the search field. The required information will appear under the Errata section.


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.


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.