In the previous section, we read about three transforming operators and saw the map operator in action. In this subsection, we will work with flatMap and flatMapLatest and see how we can implement these operators in a code base. Let's start with flatMap.
Switch over to the playground and comment out the code that we wrote so far in order to segregate the outputs of these operators from map which was implemented earlier.
First, we will declare a GamePlayer struct with a playerScore property that is a Variable event of the Int type. We will also declare a disposeBag, as follows:
executeProcedure(for: "flatMap and flatMapLatest") { struct GamePlayer { let playerScore: Variable<Int> } let disposeBag = DisposeBag ...