Using the MVI pattern in Swift iOS App development

Marcel Kulina
10 min readJan 6, 2020

In the last couple of years, several new patterns emerged, all praising to make a developer’s life as easy as never before. By separating certain parts of the codebase, each of these patterns tries to make code more readable, easier to test, and eventually more maintainable.

This tutorial assumes a basic understanding of RxSwift, RxCocoa, Databindings, and how to use Cocoapods. Thus I won’t go into detail regarding these topics. Prior knowledge about other MVI* patterns does help but is not required.

MVI(Model-View-Intent) isn’t an entirely new pattern. Instead, it is built upon existing principles that have been used in the industry for years now. As the name already states, MVI adds to the list of MV* patterns. While these designs are traditionally imperative, reactive extensions have become more famous during the last decade. Especially concepts like MVVM moved closer to reactive programming, sometimes replacing imperative paradigms completely.

MVI was designed with reactive programming in mind. By using a framework, such as ReactiveX(http://reactivex.io), it unleashes its full potential, placing it further away from its siblings. While the imperative approach is possible, it counteracts the usefulness of…

--

--

No responses yet