Application Development with Swift
eBook - ePub

Application Development with Swift

  1. 144 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Application Development with Swift

About this book

Develop highly efficient and appealing iOS applications by using the Swift language

About This Book

  • Develop a series of applications with Swift using the development kits and new/updated APIs
  • Use the new features of iOS 8 to add new flavor to your applications
  • A hands-on guide with detailed code snippets to aid you in developing powerful Swift applications

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.

What You Will Learn

  • Use playgrounds in Xcode to make the writing of Swift code productive and easy
  • Get acquainted with the advanced features of Swift and make complete use of them in your code
  • Add a new method for authentication to your app using Touch ID
  • Develop health-related apps using HealthKit
  • Take your apps to the next level of performance and capability using Metal
  • Develop applications for wearables using WatchKit
  • Use Notification Center to easily access all your notifications
  • Make your users devices more stylish by using Apple's built-in Quick Type keyboard, instead of the native one

In Detail

After years of using Objective-C for developing apps for iOS/Mac OS, Apple now offers a new, creative, easy, and innovative programming language for application development, called Swift. Swift makes iOS application development a breeze by offering speed, security and power to your application development process. Swift is easy to learn and has awesome features such as being open source, debugging, interactive playgrounds, error handling model, and so on. Swift has simplified its memory management with Automatic Reference Counting (ARC) and it is compatible with Objective-C.

This book has been created to provide you with the information and skills you need to use the new programming language Swift. The book starts with an introduction to Swift and code structure. Following this, you will use playgrounds to become familiar with the language in no time. Then the book takes you through the advanced features offered by Swift and how to use them with your old Objective-C code or projects. You will then learn to use Swift in real projects by covering APIs such as HealthKit, Metal, WatchKit, and Touch ID in each chapter. The book's easy to follow structure ensures you get the best start to developing applications with Swift.

Style and approach

The book achieves its end goal by dividing its content into two parts. Part 1 will take the readers, who are new to Swift, through its architecture and basics. Part 2 of the book will cover content on application development with Swift.

Tools to learn more effectively

Saving Books

Saving Books

Keyword Search

Keyword Search

Annotating Text

Annotating Text

Listen to it instead

Listen to it instead

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

Credits

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

About the Author

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 .

About the Reviewers

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...

Table of contents

  1. Application Development with Swift

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Application Development with Swift by Hossam Ghareeb in PDF and/or ePUB format, as well as other popular books in Computer Science & Application Development. We have over one million books available in our catalogue for you to explore.