RESULT BUILDERS AND DSL — X — FILE

THE MAGIC

I STILL DON’ T UNDERSTAND HOW IT WORKS

SwiftUI view builder
SwiftUI view builder at compile time

WHY SHOULD I USE THEM?

RESULT BUILDER ANATOMY

LET’ S CREATE A MARKDOWN(-ish) BUILDER

Some abstractions to make our Markdown editor
Our DSL objects
MarkdownDoc
Vanilla result builder implementation
Vanilla MarkdownDoc
A lot better markdown implementation
Builder method to add only IF statement
Builder methods to add IF-ELSE statement
Magic revealed
Builder methods to add FOR loops

FINAL THOUGHTS

--

--

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