@@ -13,6 +13,7 @@ final class ZoomedImageRootViewController: UIViewController {
1313 // MARK: - Properties
1414 private var subscriptions : Set < AnyCancellable > = [ ]
1515 private var initialTouchPoint = CGPoint ( x: 0 , y: 0 )
16+ private let shouldShowTitle : Bool
1617
1718 // MARK: - UI Components
1819 private let zoomedImageCollectionView = ZoomedImageCollectionView ( )
@@ -28,6 +29,15 @@ final class ZoomedImageRootViewController: UIViewController {
2829 $0. endPoint = CGPoint ( x: 0.0 , y: 1.0 )
2930 }
3031
32+ // MARK: - Initializer
33+ init ( shouldShowTitle: Bool = true ) {
34+ self . shouldShowTitle = shouldShowTitle
35+ super. init ( nibName: nil , bundle: nil )
36+ }
37+ required init ? ( coder: NSCoder ) {
38+ fatalError ( " init(coder:) has not been implemented " )
39+ }
40+
3141 // MARK: - Life Cycle
3242 override func viewDidLoad( ) {
3343 super. viewDidLoad ( )
@@ -49,13 +59,18 @@ final class ZoomedImageRootViewController: UIViewController {
4959 // MARK: - Configure
5060 func configure( urls: [ String ] , initialIndexPath: IndexPath ) {
5161 zoomedImageCollectionView. configure ( urls: urls, initialIndexPath: initialIndexPath)
52- title = " \( initialIndexPath. row+ 1 ) / \( urls. count) "
62+ if shouldShowTitle {
63+ title = " \( initialIndexPath. row+ 1 ) / \( urls. count) "
64+ }
5365 }
5466
5567 // MARK: - Bind
5668 private func bind( ) {
5769 zoomedImageCollectionView. updateTitlePublisher. sink { [ weak self] title in
58- self ? . title = title
70+ if let self,
71+ self . shouldShowTitle {
72+ self . title = title
73+ }
5974 } . store ( in: & subscriptions)
6075
6176 zoomedImageCollectionView. hideNavigationBarPublisher. sink { [ weak self] isHidden in
0 commit comments