PanModal/PanModal/View/PanContainerView.swift

40 lines
810 B
Swift

//
// PanContainerView.swift
// PanModal
//
// Copyright © 2018 Tiny Speck, Inc. All rights reserved.
//
import UIKit
/**
A view wrapper around the presented view in a PanModal transition.
This allows us to make modifications to the presented view without
having to do those changes directly on the view
*/
class PanContainerView: UIView {
init(presentedView: UIView, frame: CGRect) {
super.init(frame: frame)
addSubview(presentedView)
}
required init?(coder aDecoder: NSCoder) {
fatalError()
}
}
extension UIView {
/**
Convenience property for retrieving a PanContainerView instance
from the view hierachy
*/
var panContainerView: PanContainerView? {
return subviews.compactMap({ $0 as? PanContainerView }).first
}
}