Thursday, June 06, 2019

Declarative UI - SwiftUI

I’ve been super impressed with the new SwiftUI framework, with the admirable aims of:
  • Declarative, meaning that we say what we want rather than how we get there.
  • Automatic, meaning that it takes care of many things we had to do by hand previously.
  • Compositional, meaning that we build small things and combine them together into larger things.
  • Consistent, meaning that we don’t see strange fault lines between Swift and Objective-C like we did previously, or very old APIs mixed up with very new ones.

For example, here’s some SwiftUI from the examples:




I can’t help but think back to some other UI declarative tools I’ve used in the past … for example, using Dialog Tag Language (DTL) back in the day (ok, in the '80s):


which produces the screen like this:



I know that SwiftUI takes the declaration to a sophisticated, modern level, but it's good to see good ideas come back into use.