Last active
January 26, 2021 14:28
-
-
Save Gagan5278/2cfef43b2ef5281ff70e333d1f3e8a77 to your computer and use it in GitHub Desktop.
This file contains 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 addSubviews(_ views: UIView...) { | |
views.forEach{addSubview($0)} | |
} | |
} | |
##How to Use: | |
class YourViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let view1 = UIView() | |
let view2 = UIView() | |
let imgView = UIImageView(image: "plane") | |
let view3 = UIView() | |
let lable = UILabel() | |
//Call here | |
self.view.addSubViews(view1, view2, imgView, view3, lable) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment