refactored for right growable views
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
12f4235f2d
commit
4269ded448
@ -55,7 +55,8 @@ class BadgeViewController: BaseViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
addContentTopView(view: badge)
|
||||
|
||||
addContentTopView(view: .makeWrapper(for: badge))
|
||||
setupForm()
|
||||
setupPicker()
|
||||
setupModel()
|
||||
|
||||
@ -10,6 +10,21 @@ import UIKit
|
||||
import Combine
|
||||
import VDS
|
||||
|
||||
extension UIView {
|
||||
public static func makeWrapper(for view: UIView) -> UIView {
|
||||
let wrapper = UIView().with {
|
||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||
}
|
||||
wrapper.addSubview(view)
|
||||
view
|
||||
.pinTop()
|
||||
.pinBottom()
|
||||
.pinLeading()
|
||||
view.trailingAnchor.constraint(lessThanOrEqualTo: wrapper.trailingAnchor).isActive = true
|
||||
return wrapper
|
||||
}
|
||||
}
|
||||
|
||||
public class BaseViewController: UIViewController, Initable {
|
||||
deinit {
|
||||
print("\(Self.self) deinit")
|
||||
|
||||
@ -24,7 +24,7 @@ class ButtonViewController: BaseViewController {
|
||||
items: ButtonSize.allCases)
|
||||
}()
|
||||
|
||||
var disabledSwitch = UISwitch()
|
||||
var disabledSwitch = Toggle()
|
||||
var textField = TextField()
|
||||
var widthTextField = TextField()
|
||||
|
||||
@ -32,17 +32,9 @@ class ButtonViewController: BaseViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
addContentTopView(view: .makeWrapper(for: button))
|
||||
|
||||
let view = UIView()
|
||||
view.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(button)
|
||||
button.pinTop()
|
||||
button.pinBottom()
|
||||
button.pinLeading()
|
||||
button.trailingAnchor.constraint(lessThanOrEqualTo: view.trailingAnchor).isActive = true
|
||||
|
||||
addContentTopView(view: view)
|
||||
|
||||
setupForm()
|
||||
setupPicker()
|
||||
setupModel()
|
||||
|
||||
@ -24,14 +24,7 @@ class TextLinkCaretViewController: BaseViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
let view = UIView()
|
||||
view.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(textLinkCaret)
|
||||
textLinkCaret.pinTop()
|
||||
textLinkCaret.pinBottom()
|
||||
textLinkCaret.pinLeading()
|
||||
textLinkCaret.trailingAnchor.constraint(lessThanOrEqualTo: view.trailingAnchor).isActive = true
|
||||
addContentTopView(view: view)
|
||||
addContentTopView(view: .makeWrapper(for: textLinkCaret))
|
||||
|
||||
setupForm()
|
||||
setupPicker()
|
||||
|
||||
@ -24,14 +24,8 @@ class TextLinkViewController: BaseViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
let view = UIView()
|
||||
view.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(textLink)
|
||||
textLink.pinTop()
|
||||
textLink.pinBottom()
|
||||
textLink.pinLeading()
|
||||
textLink.trailingAnchor.constraint(lessThanOrEqualTo: view.trailingAnchor).isActive = true
|
||||
addContentTopView(view: view)
|
||||
|
||||
addContentTopView(view: .makeWrapper(for: textLink))
|
||||
|
||||
setupForm()
|
||||
setupPicker()
|
||||
|
||||
@ -46,7 +46,7 @@ class ToggleViewController: BaseViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
addContentTopView(view: toggle)
|
||||
addContentTopView(view: .makeWrapper(for: toggle))
|
||||
|
||||
setupForm()
|
||||
setupPicker()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user