Declarative UIKit for iOS apps
CLASS
DHDScrollViewopen class DHDScrollView: UIView
Vertically scrolling view that uses a stack view to handle subviews
viewsDidBecomeVisiblepublic var viewsDidBecomeVisible: (([UIView]) -> Void)?
scrollViewpublic var scrollView = UIScrollView(frame: CGRect.zero).declaredWith { instance in
    instance.translatesAutoresizingMaskIntoConstraints = false
    instance.layoutMargins = .zero
}
stackpublic var stack = UIStackView(frame: CGRect.zero).declaredWith { instance in
    instance.translatesAutoresizingMaskIntoConstraints = false
    instance.axis = .vertical // ScrollableView is designed only to scroll on a vertical axis
}
init(fromSuper:)public init(fromSuper superView: UIView)
init(coder:)init(fromSuper:_:)public convenience init(fromSuper superView: UIView, _ byAddingArrangedSubviews: @escaping () -> [UIView?])
Create this view with a predetermined array of views
| Name | Description | 
|---|---|
| superView | the superview to render this view in | 
init(fromSuper:with:)public convenience init(fromSuper superView: UIView, with views: [UIView])
Create this view with a predetermined array of views
| Name | Description | 
|---|---|
| superView | the superview to render this view in | 
| views | the predetermined array of views to render | 
init(fromSuper:forEach:style:convertToView:)public convenience init<T>(fromSuper superView: UIView, forEach array: [T], style: UIStackView.DividerStyle = .innerOuter, convertToView: @escaping (T) -> UIView)
Create a scrollable view dynamically from a collection
| Name | Description | 
|---|---|
| superView | the superview to render this view into | 
| array | the array of data to iterate | 
| style | how should dividers be displayed | 
| convertToView | closure to call on each element in the array to convert it to a view | 
didMoveToSuperview()override public func didMoveToSuperview()
updateConstraints()override public func updateConstraints()
setLayoutMargins(verticalMargin:horizontalMargin:)public func setLayoutMargins(verticalMargin: CGFloat, horizontalMargin: CGFloat)
Set the layoutMargins of the Stack
| Name | Description | 
|---|---|
| verticalMargin | The top and bottom margins | 
| horizontalMargin | The left and right margins |