iOS) PanModal 오픈 라이브러리를 사용해서 모달창 만들기
오픈 라이브러리 PanModal 사용하기
- 모달창을 띄우고 싶은 뷰컨
 
import PanModal
//...
// MARK: - @IBAction Properties
    @IBAction func sortButton(_ sender: Any) {
                let storyboard = UIStoryboard(name: Const.Storyboard.Name.SortPanModal, bundle: nil)
        let vc = storyboard.instantiateViewController(withIdentifier: Const.ViewController.Name.SortPanModal) as! SortPanModalVC
        self.presentPanModal(vc)
    }
- 모달창 뷰컨
 
import PanModal
class SortPanModalVC: UIViewController {
    
    // MARK: - View Life Cycle
    override func viewDidLoad() {
        super.viewDidLoad()
// ...
    }
    
// ...
}
// MARK: - PanModalPresentable
extension SortPanModalVC: PanModalPresentable {
    // 스크롤되는 tableview 나 collectionview 가 있다면 여기에 넣어주면 PanModal 이 모달과 스크롤 뷰 사이에서 팬 제스처를 원활하게 전환합니다.
    var panScrollable: UIScrollView? {
        return nil
    }
    
    var shortFormHeight: PanModalHeight {
        return .contentHeight(280)
    }
    var longFormHeight: PanModalHeight {
        return .maxHeightWithTopInset(0)
    }
}
완성

모달창 높이 속성값
- contentHeight
 

- contentHeightIgnoringSafeArea
 

- intrinsicHeight
 

- maxHeight
 

- maxHeightWithTopInset
 
