Book Image

Reactive Programming with Swift

By : Cecil Costa
Book Image

Reactive Programming with Swift

By: Cecil Costa

Overview of this book

<p><span id="description" class="sugar_field">Reactive programming helps you write applications that are more powerful and efficient. You can write more software, help more people, and create applications that scale. Reactive programming is a growing paradigm that we will help you set to work in Swift.</span></p> <p><span class="sugar_field"><span id="description" class="sugar_field"> Reactive Programming with Swift guides you through migrating from the traditional way of developing to the new ReactiveCocoa framework, which uses Swift as its main programming language. You will learn how to develop with this framework, debug code, create unit tests, use additional frameworks, and convert a traditional framework into a ReactiveCocoa one.</span></span></p> <p><span class="sugar_field"><span id="description" class="sugar_field"><span id="description" class="sugar_field"> Starting with a crash course on the fundamental concepts of Reactive programming, we’ll set you up so you’re ready to create reactive applications. We’ll then move on to topics such as Graphical events, Streaming, and Core data, which will help you dive deeper with advanced programming. The concept of switching your programming concepts from imperative to functional reactive programming will also be covered. By the end of this book, you will be able to successfully create highly functional apps using Swift.</span> </span></span></p>
Table of Contents (14 chapters)
Reactive Programming with Swift
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Creating unit tests


Performing unit tests is the traditional way of testing your application and trying to detect failures when a commit is pushed to the server. This way, you can reduce the number of bugs in your application and also ensure that your software is working as expected. Basically, it consists of creating functions that call your object methods and check whether the final result is the one expected.

There also are methodologies based on unit tests, such as test-driven development and behavior-driven development. These methodologies assume that for every development cycle, you have to create the unit tests first.

Xcode comes with a built-in framework called XCTest, which is the one we are going to use in this section. If you prefer using a different framework, feel free to do so; the concepts should be similar. The steps for creating unit tests are as follows:

  1. Open Xcode and create a new project called Chapter 7 Testing. Ensure that Swift is the main language and the checkboxes...