Skip to content

Instantly share code, notes, and snippets.

@theffc
Last active March 1, 2021 17:06
Show Gist options
  • Save theffc/7ed7b4ac57bd3a92fa1baa1af2317364 to your computer and use it in GitHub Desktop.
Save theffc/7ed7b4ac57bd3a92fa1baa1af2317364 to your computer and use it in GitHub Desktop.
A comparison between UIKit default `addSubview` method, and a function builder approach
// Antes
view.addSubview(title)
view.addSubview(stackHorizontal)
stackHorizontal.addArrangedSubview(icon)
stackHorizontal.addArrangedSubview(text)
view.addSubview(description)
view.addSubview(button)
// Depois
view.subviews {
title
stackHorizontal.subviews {
icon
text
}
description
button
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment