import UIKit final class RDPDFReaderContentCell: UICollectionViewCell { var hostedView: UIView? { didSet { oldValue?.removeFromSuperview() guard let hostedView else { return } contentView.addSubview(hostedView) hostedView.frame = contentView.bounds hostedView.autoresizingMask = [.flexibleWidth, .flexibleHeight] } } }