mvm_core_ui/MVMCoreUI/BaseControllers/ContainerCollectionReusableView.swift
2020-04-07 15:29:23 -04:00

26 lines
832 B
Swift

//
// ContainerCollectionReusableView.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 4/7/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
public class ContainerCollectionReusableView: UICollectionReusableView {
var view: UIView?
var topConstraint: NSLayoutConstraint?
var bottomConstraint: NSLayoutConstraint?
public func addAndContain(view: UIView) {
self.view?.removeFromSuperview()
view.setContentCompressionResistancePriority(.required, for: .vertical)
addSubview(view)
self.view = view
let constraints = NSLayoutConstraint.constraintPinSubview(toSuperview: view)
topConstraint = constraints?[ConstraintTop] as? NSLayoutConstraint
bottomConstraint = constraints?[ConstraintBot] as? NSLayoutConstraint
}
}