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 the checkout scene


The checkout scene has a layout similar to the first one. The difference is that in the table view, we will show products in the shopping cart, and it will allow the user to change the current currency.

Firstly, add a new Swift file to you project, and call it CheckoutViewController.swift. Here, we just need to create a class to let the storyboard know which class the second scene belongs to. Go ahead and import UIKit and the ReactiveCocoa framework. After this, create a class that inherits from UIViewController and implements UITableViewDataSource, as demonstrated here:

import UIKit 
import ReactiveCocoa 
 
class CheckoutViewController: UIViewController,UITableViewDataSource { 
} 

Return to the storyboard, and add a new View Controller to it. Select the new View Controller, and change its Class to CheckoutViewController by going to Identity Inspector using commandOption3 and updating the Class field, as demonstrated here:

You need...