Book Image

Swift Essentials - Second Edition

By : Alex Blewitt
Book Image

Swift Essentials - Second Edition

By: Alex Blewitt

Overview of this book

Swift was considered one of the biggest innovations last year, and certainly with Swift 2 announced at WWDC in 2015, this segment of the developer space will continue to be hot and dominating. This is a fast-paced guide to provide an overview of Swift programming and then walks you through in detail how to write iOS applications. Progress through chapters on custom views, networking, parsing and build a complete application as a Git repository, all by using Swift as the core language
Table of Contents (17 chapters)
Swift Essentials Second Edition
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Preface
Index

Best practice for watch applications


As watches are very low-powered devices with limited networking, care should be taken to reduce networking where possible. The example application shown here (using several REST-based calls to a backend server) is sending and receiving more data than needed; if this was being designed as a custom application, then the protocol should be minimized to avoid unnecessary data transmission.

The example application also presented user information as a list of text data, which may not be the most appropriate way of showing data. Consider other mechanisms to present information in a more graphical way where appropriate.

UI thread considerations

It is generally bad practice to perform any networking on the main thread, such as the lookups for the API, and for the query for a user's repositories. Instead, the lookups should be run in a background thread, switching back to the UI thread where necessary to perform updates.

For example, in the API lookup for the connection...