Hands-On Design Patterns with Swift
Master Swift best practices to build modular applications for mobile, desktop, and server platforms
Florent Vilmart
Giordano Scalzo
Sergio De Simone
BIRMINGHAM - MUMBAI
Hands-On Design Patterns with Swift
Copyright 2018 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 authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been 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.
Commissioning Editor: Kunal Chaudhari
Acquisition Editor: Devanshi Doshi
Content Development Editor: Francis Carneiro
Technical Editor: Sachin Sunilkumar
Copy Editor: Safis Editing
Project Coordinator: Kinjal Bari
Proofreader: Safis Editing
Indexer: Mariammal Chettiyar
Graphics: Alishon Mendonsa
Production Coordinator: Priyanka Dhadke
First published: December 2018
Production reference: 1211218
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78913-556-5
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Packt.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@packtpub.com for more details.
At www.packt.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the authors
Florent Vilmart, M.Sc., is a full stack engineer in Montreal. Born in France, he moved to Montreal shortly before graduating, seeking exciting opportunities in the francophone metropole of North America. He honed his skills with Objective-C before jumping to Swift when it was released. He is a polyglot, and you can find his open source work on the parse community GitHub project, where he is one of the core maintainers. He has spoken at conferences, including the GitHub CodeConf in 2016 and, most recently, the 2017 Swift Summit in San Francisco. Currently, he is working full-time with BusBud in Montreal, using mainly TypeScript alongside Swift.
Writing a first book is a daunting challenge, even more so when you have three children to take care of at the same time. I want to start by thanking Elodie, my life partner, without whom writing this book would never have been possible. She has provided both support and encouragement during the process. Elodie, thank you many times over.
Many thanks to Francis at Packt Publishing for keeping my spirits up in the darkest days, always encouraging and looking forward.
I also wish to thank all the leaders and makers of the Swift community that I had the chance to meet in person or online, many of whom are a source of inspiration through their open source work, blogs, and conferences. Without such a vibrant community, this book would not have been possible.
Many thanks are due to my mom and dad. They both taught me that anything and everything is possible in this world, and my brothers, with whom I had the best time and who helped me to disconnect and take a step back when I needed it the most .
Giordano Scalzo is a developer with 20 years of programming experience, since the days of the ZX-Spectrum. He has worked in C++, Java, .NET, Ruby, Python, and in a multitude of other languages. After years of backend development, Giordano has developed extensively for iOS, releasing more than 20 apps which he wrote for clients, enterprise applications, or for his own benefit. Currently, he is a contractor in London where, through his company, Effective Code Ltd., he delivers code for iOS. For Packt, he has written two books on Swift, Swift by Example and Swift 2 by Example, and has reviewed a number of Swift books and videos, including Learn Swift by Building Applications, Introduction to Server-Side Swift, and Swift Functional Programming.
I'd like to thank my better half, Valentina, who lovingly supports me in everything I do: without you, none of this would have been possible. Thanks to my bright future, Mattia and Luca, for giving me lots of smiles and hugs when I needed them. Thanks to Francis, for making this book better. Finally, my gratitude goes to my mom and my dad, who piqued my curiosity and supported me in the pursuit of my passions, which begun one day when they bought me a ZX-Spectrum.
Sergio De Simone has been working as a software engineer for over twenty years across a range of different projects and companies, including work environments such as Siemens, HP, and small start-ups. For the last few years, his focus has been on developing mobile platforms and related technologies. He is currently working for BigML, Inc., where he leads iOS and OS X development. Additionally, he likes writing about technology, as well as programming tools, techniques, and languages, with a special focus on Swift evolution, for InfoQ.
About the reviewers
Tibor Bdecs is an enthusiastic software developer with more than a decade of experience in the IT industry. Previously, Tibor was the technology leader at one of the biggest mobile development-focused companies in Hungary. He is a self-taught programmer with a true passion for Swift. He has the ability to work with different languages and technologies, and has extensive experience in product management. Nowadays, he is a freelance developer focusing predominantly on web, mobile, and server-side Swift projects. Tibor has a personal blog where he regularly writes about the Swift programming language.
Next page