Reactive Programming with Swift 4
eBook - ePub

Reactive Programming with Swift 4

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

Reactive Programming with Swift 4

Book details
Book preview
Table of contents
Citations

About This Book

Learn how to solve blocking user experience and build event based reactive applications with Swift.About This Book• Build fast and scalable apps with RxSwift• Apply reactive programming to solve complex problems and build efficient programs with reactive user interfaces• Take expressiveness, scalability, and maintainability of your Swift code to the next level with this practical guideWho This Book Is ForThis book is for the developers who are familiar with Swift and iOS application development and are looking out to reduce the complexity of their apps. Prior experience of reactive programming is not necessary.What You Will Learn• Understand the practical benefits of Rx on a mobile platform• Explore the building blocks of Rx, and Rx data flows with marble diagrams• Learn how to convert an existing code base into RxSwift code base• Learn how to debug and test your Rx Code• Work with Playgrounds to transform sequences by filtering them using map, flatmap and other operators• Learn how to combine different operators to work with Events in a more controlled manner.• Discover RxCocoa and convert your simple UI elements to Reactive components• Build a complete RxSwift app using MVVM as design patternIn DetailRxSwift belongs to a large family of Rx implementations in different programming languages that share almost identical syntax and semantics. Reactive approach will help you to write clean, cohesive, resilient, scalable, and maintainable code with highly configurable behavior.This book will introduce you to the world of reactive programming, primarily focusing on mobile platforms. It will tell how you can benefit from using RxSwift in your projects, existing or new. Further on, the book will demonstrate the unbelievable ease of configuring asynchronous behavior and other aspects of the app that are traditionally considered to be hard to implement and maintain. It will explain what Rx is made of, and how to switch to reactive way of thinking to get the most out of it. Also, test production code using RxTest and the red/ green approach. Finally, the book will dive into real-world recipes and show you how to build a real-world app by applying the reactive paradigm.By the end of the book, you'll be able to build a reactive swift application by leveraging all the concepts this book takes you through.Style and approachThis book is a definite tutorial in FRP with Swift filled with well-described examples.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
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 1000+ topics, we’ve got you covered! Learn more here.
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 here.
Yes, you can access Reactive Programming with Swift 4 by Navdeep Singh in PDF and/or ePUB format, as well as other popular books in Computer Science & Operating Systems. We have over one million books available in our catalogue for you to explore.

Information

Year
2018
ISBN
9781787128781
Edition
1

Reduce by Combining and Filtering and Common Trade Offs

Sometimes we want to work with multiple Observable sequences, reacting to new elements emitted from one or more of those sequences. There are a handful of operators that combine Observable sequences in a variety of ways. In this chapter, we will explore such operators that allow us to combine and filter Observable sequences.
In this chapter, we will cover the following topics:
  • Concatenating and prefixing
  • Merging
  • Zipping
  • Performing side effects
  • Creating a demo application to cover all the topics covered so far

Combining and filtering Observable sequences

In the previous chapters, we learned how to create, transform, and filter Observable sequences. You would have found a lot of similarities between filtering of RxSwift, transforming operators, and traditional Swift's standard collection methods. You got acquainted with the true power of RxSwift while working with operators such as flatMap where you had to write very little code to get a great deal of work done.
This chapter will show you various techniques with which you can assemble and combine sequences to control data as desired. Before delving into the concepts, let's set up the project first.

Project setup

As discussed earlier, let's set up a workspace to work with RxSwift:
  1. Create a single view application project and name it RxAdvancedOperators.
  2. Open Terminal.app and navigate to the project folder. Create a podfile inside your Xcode projects folder by executing the pod init command. Once the command is executed, you will see a Podfile in the project folder:
  3. Open the created Podfile and paste the Podfile code:
# Uncomment the next line to define a global platform for your project


target 'RxAvancedOperators' do
# Comment the next line if you're not using Swift ...

Table of contents

  1. Title Page
  2. Copyright and Credits
  3. Packt Upsell
  4. Contributors
  5. Preface
  6. Migrating from Swift 3 to Swift 4
  7. FRP Fundamentals, Terminology, and Basic Building Blocks
  8. Set up RxSwift and Convert a Basic Login App to its RxSwift Counterpart
  9. When to Become Reactive?
  10. Filter, Transform, and Simplify
  11. Reduce by Combining and Filtering and Common Trade Offs
  12. React to UI Events – Start Subscribing
  13. RxTest and Custom Rx Extensions – Testing with Rx
  14. Testing Your RxCode – Testing Asynchronous Code
  15. Schedule Your Tasks, Don't Queue!
  16. Subscribe to Errors and Save Your App
  17. Functional and Reactive App-Architecture
  18. Finish a Real-World Application
  19. Other Books You May Enjoy