What this article is about

In this article, we’ll make an Updater protocol. Updaters will enforce a set of rules that dictate when a view should update. In particular, we’ll make three separate updaters to suit different situations:

  1. Updaters.Nonduplicate — updates when its equality is broken
  2. Updaters.True — updates when its value is true
  3. Updaters.Event — updates when it receives a value from a publisher
view.modifier(Updaters.Nonduplicate(equatable))view.modifier(Updaters.True(boolean))view.modifier(Updaters.Event(publisher))

How views are updated

Views propagate changes by recalculating their body, which in turn tells each subview to recalculate its body, so on and so forth. Views tend to…


What this article is about

Views are easy to use, easy to reuse, and easily composable. You know how to use them, I know how to use them, so this is not going to be an article on how to use them but rather on how the View protocol works. In doing this, I will show you how to make a simple Text protocol that can be used to build strings rather than views.

Our destination

What we’re making will be simple. We will not concern ourselves with features like the environment or preferences, nor will we concern ourselves with statefulness or modifiers. …


Imagine you want to store an object (with a publisher) and update it based on some event. One way to accomplish this would be the following:

  1. Store the object and its publisher somewhere.
  2. Create a publisher that describes how to update the object.
  3. Create a subscription that connects the object and the publisher.
  4. Store the subscription somewhere.

Oscar Byström Ericsson

I tried to be normal once.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store