FormsKit: reactive forms driven by state

David Rodrigues
Senior iOS Engineer at Babylon Health, UK

State can be a tricky thing in every system specially when’s manipulated in different places, causes some side-effects, … On mobile apps, it can be especially challenging when we have highly dynamic user interfaces driven by some state(s) and a great example of that are forms where is frequent to see some collapsable rows or entire sections being inserted, removed or even both. Manually managing all of that can be quite complex and most of the times ends up not being sufficiently generic to be reused by every form which increases the effort of not only developing but also maintaining each form within an app. And if that was not enough, there's also the question of reading and understanding precisely the structure of a single form which most of the times are imperative and composed by many components, e.g. delegates, data sources, ..., making it even more hard to maintain and modify. FormsKit born as a need to manage a reasonable number of forms in a declarative and composable way through a descriptive state.

FormsKit follows a React-based approach to render and manage a form through a virtual representation which is completely driven by any change in a single core state. This enables deriving an interface for a very specific state instead of patching it manually which requires knowledge of the current state of the form, which can actually be many combinations, to then determine the correspondent transition to reflect the new state. FRP plays an essential role as the base to track any change in the core state and consequently triggering a new form's representation plus notify those changes as a stream of values. 

Despite the focus in FormsKit framework, the main goal is to demonstrate how we should change our way of thinking to derive interfaces, and even other states, through a single state instead of doing the other way around, avoiding manual and localised changes which are not easy to understand, maintain and finally test.

About speaker

David has been working in iOS apps (and sometimes frameworks) in the past 5 years and dived deeply in Swift and FRP in the past 2.5 years being a strong evangelist of both since then. He strongly believes in open source and is also passionate about backend systems. He enjoys not only coding but also teach and discuss different concepts and ideas.
All topics   
Register to get the digest of reports, news and announcements of events.