BaseBottomSheetViewController는 height를 지정해야 한다. CustomBottomSheetViewController.view는 BaseBottomSheetViewController의 bottomSheetView가 된다.
Coordinator를 적용하고 있기 때문에,
// in Coordinator
bottomSheetViewController.add(
child: photoBottomSheetVC,
container: bottomSheetViewController.bottomSheetView
)
bottomSheetViewController.modalPresentationStyle = .overFullScreen
self.present(bottomSheetViewController, animated: false)
가 된다.
문제는 height를 작성하는 곳의 위치이다. 현재로써는 Coordinator에서 BaseBottomSheetViewController를 생성할 때 넣어주고 있는데 Coordinator는 화면전환 담당 목적이기 때문에, View의 height를 지정해주는건 부적절하다고 생각했다.
또한 현재의 문제점은 BaseBottomSheetVC와 CustomBottomSheetVC를 둘다 생성해야 한다는 점이다. 어차피 하나의 뷰컨트롤러만 coordinatorDependency가 make해도 충분하다고 생각했다.
위의 문제점들을 해결하기 위해서는 BaseBottomSheetVC를 상속받는 CustomBottomSheetVC를 정의하는 것이다. 이렇게 정의하면 BaseBottomSheetVC가 detent를 정의하고 CustomBottomSheetVC가 내부에서 detent를 초기화해준다.
그리고 coordinator는 CustomBottomSheetVC하나만 make한다. 또한 detent를 Coordinator에서 정의하지 않아도 되기 때문에 SRP, OCP를 지킬 수 있다.