Reactive Programming with Swift 4
Build asynchronous reactive applications with
easy-to-maintain and clean code using RxSwift and Xcode 9
Navdeep Singh
BIRMINGHAM - MUMBAI
Reactive Programming with Swift 4
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 author, 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: Isha Raval
Content Development Editor: Flavian Vaz
Technical Editor: Akhil Nair
Copy Editor: Shaila Kusanale
Project Coordinator: Devanshi Doshi
Proofreader: Safis Editing
Indexer: Rekha Nair
Graphics: Jason Monteiro
Production Coordinator: Shraddha Falebhai
First published: February 2018
Production reference: 1210218
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78712-021-1
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
PacktPub.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.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.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 author
Navdeep Singh is a result-oriented software developer and research professional with more than 7 years of experience in both development and research positions. He strives to create software with the user in mind, creating applications with a usable and intuitive user interface experience. Navdeep spends most of his time learning about the latest trends in technology, writing blogs, playing cricket, or practicing classical Hindustani music.
Firstly, I would like to thank the Almighty, who gave me insights to follow this path of sharing knowledge. Thanks to my beloved wife, who has been in my life for less than a year and has been an inspiration for pushing me to spend hours writing this book, my parents and my family who believed in me right from the start till this very moment.
About the reviewer
Kevin Munc (@muncman) is a 20-year programming veteran with wide experience, from mainframes to mobile. Along the way, he's reviewed books on Objective-C, watchOS, UIAutomation, Sprite Kit, JavaFX, and Vim.
Id like to thank all my colleagues past and present who have helped me sharpen my reviewing skills. Im also thankful for the ongoing support of my family as I continue chasing new tech.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Preface
As a platform, iOS offers numerous APIs to write asynchronous code and, many a times, this choice becomes hard to manage and a single code base ends up comprising multiple Asynchronous API usages, for example, closures for small Async tasks, delegation for background tasks, notification center for event-based tasks, and such. Managing and modifying such a code base might become a headache even if it is written in the best way possible, and the problem becomes more severe if a big team is involved with a single code base. RxSwift brings in uniformity so that different types of requirements (mentioned earlier) are handled with RxSwift code and hence you, as a developer, get more control over the processes and different module interactions within the app.
The main mission of this book is to give you a platform to catapult your skills to be on par with the best RxSwift developers out there. Follow the content in the book as per the schedule, and rest assured that you will achieve the mission.
Who this book is for
This book is for iOS developers who have intermediate knowledge of Swift development for IOS and want to take their skill set to the next level. RxSwift offers more control over asynchronous code in your iOS environment, and, as a seasoned developer, even a slight advantage to the way asynchronous code is written is always welcome. This book will challenge the way you have been thinking about your apps' logic and guide you along the way as you turn the tables and start thinking in a more declarative way as compared to the traditional imperative way. In short, you will learn how to think in what to do terminology as compared to how to do.
For those who are eager to become a Swift Ninja, this book aims to work in a slightly unique mannerwe will dive straight into the code, and as we build on the demo applications, we will explain the concepts on the fly, as they say! Development is all about practice, and this book abides by that rule right from the word go.
What this book covers
, Migrating from Swift 3 to Swift 4, teaches whats new in Swift 4 and how you can transition your code from Swift 3 to Swift 4. Unlike the previous Swift releases, this time the conversion is more seamless, and you will see this in practice with the help of an example.
Next page