// // ContainerCollectionReusableView.swift // MVMCoreUI // // Created by Scott Pfeil on 4/7/20. // Copyright © 2020 Verizon Wireless. All rights reserved. // import Foundation /// CollectionReusableView that can contains any other view. public class ContainerCollectionReusableView: UICollectionReusableView { public var view: UIView? public var topConstraint: NSLayoutConstraint? public var bottomConstraint: NSLayoutConstraint? public func addAndContain(view: UIView) { guard self.view != view else { return } 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 } }