AddWith
AddWith copied to clipboard
:electric_plug: ADD subviews WITH its' subviews. Expect subviews' hierarchy at a look.
AddWith
🔌 Add subviews with its' subviews. Expect subviews' hierarchy at a look.
At a Glance
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)
Tips and Tricks
-
You can add subviews with array.
let subviews: [UIView] = [button, label, imageView] self.view.add(subviews)
Installation
-
pod 'AddWith'
License
AddWith is under MIT license. See the LICENSE file for more info.