@@ -16,6 +16,17 @@ final class ZoomedImageRootViewController: UIViewController {
1616
1717 // MARK: - UI Components
1818 private let zoomedImageCollectionView = ZoomedImageCollectionView ( )
19+ private let gradientView = UIView ( )
20+ private let gradientLayer = CAGradientLayer ( ) . then {
21+ $0. colors = [
22+ UIColor . black. withAlphaComponent ( 0.4 ) . cgColor,
23+ UIColor . black. withAlphaComponent ( 0.03 ) . cgColor,
24+ UIColor . black. withAlphaComponent ( 0.0 ) . cgColor
25+ ]
26+ $0. locations = [ 0.0 , 0.9 , 1.0 ]
27+ $0. startPoint = CGPoint ( x: 0.0 , y: 0.0 )
28+ $0. endPoint = CGPoint ( x: 0.0 , y: 1.0 )
29+ }
1930
2031 // MARK: - Life Cycle
2132 override func viewDidLoad( ) {
@@ -30,6 +41,11 @@ final class ZoomedImageRootViewController: UIViewController {
3041 configureNavigationBar ( style: . transparentWhite)
3142 }
3243
44+ override func viewDidLayoutSubviews( ) {
45+ super. viewDidLayoutSubviews ( )
46+ gradientLayer. frame = gradientView. bounds
47+ }
48+
3349 // MARK: - Configure
3450 func configure( urls: [ String ] , initialIndexPath: IndexPath ) {
3551 zoomedImageCollectionView. configure ( urls: urls, initialIndexPath: initialIndexPath)
@@ -92,11 +108,17 @@ extension ZoomedImageRootViewController {
92108extension ZoomedImageRootViewController {
93109
94110 private func configureView( ) {
95- [ zoomedImageCollectionView ] . forEach {
111+ [ zoomedImageCollectionView, gradientView ] . forEach {
96112 view. addSubview ( $0)
97113 }
98114 zoomedImageCollectionView. snp. makeConstraints {
99115 $0. edges. equalToSuperview ( )
100116 }
117+ gradientView. snp. makeConstraints {
118+ $0. top. leading. trailing. equalToSuperview ( )
119+ $0. bottom. equalTo ( view. safeAreaLayoutGuide. snp. top)
120+ }
121+
122+ gradientView. layer. addSublayer ( gradientLayer)
101123 }
102124}
0 commit comments