Created
May 7, 2019 13:23
-
-
Save digoreis/faf8aa0f549f95fcf7662fd49ebb8f95 to your computer and use it in GitHub Desktop.
Create a UIView
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
func create<T: UIView>(usingAutoLayout: Bool = true, configure: (T) -> Void) -> T { | |
let object = T() | |
object.translatesAutoresizingMaskIntoConstraints = !usingAutoLayout | |
configure(object) | |
return object | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment