Created
February 27, 2018 21:14
-
-
Save StanislavK/ac05992681af75e35a83bd179af46de9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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