File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed
ScrollableStackView/Classes Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -16,16 +16,13 @@ import UIKit
1616 @objc open var stackView : UIStackView !
1717 @objc @IBInspectable open var spacing : CGFloat = 8
1818
19- override public func didMoveToSuperview( ) {
20- super. didMoveToSuperview ( )
21-
22- setupUI ( )
19+ required public init ? ( coder aDecoder: NSCoder ) {
20+ fatalError ( " init(coder:) has not been implemented " )
2321 }
2422
25- func setupUI( ) {
26- self . translatesAutoresizingMaskIntoConstraints = false
27- clipsToBounds = true
28-
23+ override public init ( frame: CGRect ) {
24+ super. init ( frame: frame)
25+
2926 // ScrollView
3027 scrollView = UIScrollView ( frame: self . frame)
3128 scrollView. translatesAutoresizingMaskIntoConstraints = false
@@ -38,6 +35,17 @@ import UIKit
3835 stackView. spacing = spacing
3936 stackView. distribution = . equalSpacing
4037 scrollView. addSubview ( stackView)
38+ }
39+
40+ override public func didMoveToSuperview( ) {
41+ super. didMoveToSuperview ( )
42+
43+ setupUI ( )
44+ }
45+
46+ func setupUI( ) {
47+ self . translatesAutoresizingMaskIntoConstraints = false
48+ clipsToBounds = true
4149
4250 self . setNeedsUpdateConstraints ( ) // Bootstrap auto layout
4351 }
You can’t perform that action at this time.
0 commit comments