🔌 Add subviews with its' subviews. Expect subviews' hierarchy at a look.
Add scroll view with it's subviews.
self.view.add(
self.scrollView.with(
self.contentContainer.with(
self.descriptionLabel
self.imageView
)
),
self.backgroundView.with(
self.backgroundImageView,
self.logoImageView
)
)
This is equivalent to:
self.view.addSubview(self.scrollView)
self.scrollView.addSubview(self.contentContainer)
self.contentContainer.addSubview(self.descriptionLabel)
self.contentContainer.addSubview(self.imageView)
self.view.addSubview(self.backgroundView)
self.backgroundView.addSubview(self.backgroundImageView)
self.backgroundView.addSubview(self.logoImageView)
-
You can add subviews with array.
let subviews: [UIView] = [button, label, imageView] self.view.add(subviews)
-
pod 'AddWith'
AddWith is under MIT license. See the LICENSE file for more info.