Skip to content

Instantly share code, notes, and snippets.

@StanislavK StanislavK/Foo.swift
Created Feb 27, 2018

Embed
What would you like to do?
extension UIView {
func add(_ subviews: UIView...) {
subviews.forEach(addSubview)
}
}
view.add(button)
view.add(label)
// By dropping the "Subview" suffix from the method name, both
// single and multiple arguments work really well semantically.
view.add(button, label)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.