![]()
Application Development with Swift
Table of Contents
Application Development with Swift
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Hello Swift
Introduction to Swift
Playgrounds
The code structure
Arrays
Initializing an array
Iterating over arrays
Appending items
Removing and updating items
Dictionaries
Initializing a dictionary
Appending or updating values
Removing items from the dictionary
Enum
Using enumerations with the switch statement
Enumerations with associated values
Functions
Closures
Summary
2. Advanced Swift
Type casting and type checking
Downcasting
Using Any and AnyObject
Protocols
Properties
Methods
Class-only protocols
Protocol compositions
The protocol conformance
The optional requirements
Delegation
Extensions
Adding computed properties
Adding new initializers
Adding methods
Generics
Operator functions
Memory management
Using Objective-C and Swift in a single project
Importing Objective-C in the Swift project
Importing Swift in the Objective-C project
Limitations
Summary
3. Touch ID
What is Touch ID?
The LocalAuthentication framework
Summary
4. Introduction to HealthKit
What is HealthKit?
HealthKit limitations
HealthKit privacy
Getting started with HealthKit
Configuring the Xcode project
Getting your hands dirty with HealthKit
The HealthKit store
Asking for permissions
Updating the UI
Sharing data in the Health app
Summary
5. Introduction to Metal
What is Metal?
Features
3D rendering
Pipeline
Transformations
Projection
Other options to work with 3D rendering in iOS
Getting started with Metal
Devices and CAMetalLayers
The command queue
Vertex and color buffers
Vertex and fragment shaders
The render pipeline
The game loop and rendering
The display link
The render pass
The command buffer
Summary
6. Introduction to WatchKit
Apple watch
WatchKit
The WatchKit app
Glances
Actionable notifications
Working with WatchKit
Xcode targets
Interface controllers
Interface elements
Groups
Navigating interfaces
Presenting modally
Animation
Working with glances
Summary
7. Swift App Extensions
App extensions
Today
Share
Photo Editing
Document Provider
Understanding the Document Provider's lifecycle
The custom keyboard
Keyboard security
Keyboard settings
Working with the custom keyboard
Demo
Summary
Index
![]()
Application Development with Swift
Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: August 2015
Production reference: 1250815
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78528-817-3
www.packtpub.com
![]()
Author
Hossam Ghareeb
Reviewers
Tyler Hackbart
David Mattia
Hossam M. Sherif
Kenneth Strickland
Commissioning Editor
Julian Ursell
Acquisition Editor
Nikhil Karkal
Content Development Editor
Shali Deeraj
Technical Editor
Prajakta Mhatre
Copy Editor
Charlotte Carneiro
Project Coordinator
Kinjal Bari
Proofreader
Safis Editing
Indexer
Tejal Soni
Graphics
Sheetal Aute
Disha Haria
Production Coordinator
Melwyn D'sa
Cover Work
Melwyn D'sa
![]()
Hossam Ghareeb is a software engineer who graduated from the computer and system engineering department of Alexandria University in 2012. Currently, he is an iOS software engineer at Prototype Interactive in Dubai. He has a lot of experience in iOS development and software engineering; he always keeps himself up to date with new technologies. It is his passion to help people by sharing his experience and writing tutorials to get people engaged quickly without problems. His favorite hobbies are fishing and playing video games, especially FIFA and PES. If you need his help or wish to go fishing with him, then you can contact him at
<[email protected]>.
![]()
Tyler Hackbart is a web developer, designer, and technology enthusiast with a passion for everything in technology. Through self-learning, he gained the ability to write his first line of code when he was only 16 years old and has just started learning his sixth programming language. With his farm-raised work ethic, alongside a passion for crafting amazing user interactions and doing what he loves, Tyler has successfully worked in the technology field for 2 years. He is the cofounder of three start-ups and works in an application design firm, all based in Waterloo, Canada.
David Mattia is a student at the University of Notre Dame with a passion for software engineering. He has worked for General Electric Aviation and spends much of his free time doing freelance work.
Hossam M. Sherif is a software developer. He received his bachelor's degree in computer and system engineering from Alexandria University. He has spent several years in software development, especially in iOS and backend...