Skip to content

Commit

Permalink
[#74]Feat: 마지막 더미 유저 Footer View 추가
Browse files Browse the repository at this point in the history
- footer와 section의 제약조건 설정
  • Loading branch information
Minny27 committed May 26, 2024
1 parent 8731210 commit 06d0a47
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Projects/Features/Falling/Src/Home/FallingHomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ extension NSCollectionLayoutSection {
section.contentInsets = NSDirectionalEdgeInsets(
top: 0,
leading: 16,
bottom: 0,
bottom: 16,
trailing: 16
)
section.interGroupSpacing = 14
Expand Down
93 changes: 93 additions & 0 deletions Projects/Features/Falling/Src/Subviews/DummyFooterView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
//
// DummyFooterView.swift
// Falling
//
// Created by SeungMin on 5/26/24.
//

import UIKit

import DSKit

final class DummyFooterView: UICollectionReusableView {
private lazy var cardTimeView = CardTimeView()

override init(frame: CGRect) {
super.init(frame: .zero)

configureUI()
makeUI()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

private func configureUI() {
layer.borderWidth = 1
layer.cornerRadius = 20
clipsToBounds = true
// backgroundColor = .blue
// layer.borderColor = UIColor.orange.cgColor

addGradientBackground()
addGradientBorder()
}

private func makeUI() {
addSubview(cardTimeView)

cardTimeView.snp.makeConstraints {
$0.top.leading.trailing.equalToSuperview().inset(12)
$0.height.equalTo(32)
}
}

private func addGradientBackground() {
let gradientLayer = CAGradientLayer()
gradientLayer.frame = bounds

gradientLayer.colors = [
DSKitAsset.Color.DummyUserGradient.backgroundFirst.color,
DSKitAsset.Color.DummyUserGradient.backgroundSecond.color,
DSKitAsset.Color.DummyUserGradient.backgroundFirst.color
]

gradientLayer.locations = [0.0, 0.5, 1.0]

gradientLayer.startPoint = CGPoint(x: 0.5, y: 1.0)
gradientLayer.endPoint = CGPoint(x: 0.5, y: 0.0)

// layer.addSublayer(gradientLayer)

layer.insertSublayer(gradientLayer, at: 0)
}

private func addGradientBorder() {
let gradientLayer = CAGradientLayer()
gradientLayer.frame = bounds

gradientLayer.colors = [
DSKitAsset.Color.DummyUserGradient.borderFirst.color,
DSKitAsset.Color.DummyUserGradient.borderSecond.color
]

// gradientLayer.locations = [0.0, 0.5, 1.0]

gradientLayer.startPoint = CGPoint(x: 0.5, y: 1.0)
gradientLayer.endPoint = CGPoint(x: 0.5, y: 0.0)

let shapeLayer = CAShapeLayer()
let path = UIBezierPath(roundedRect: bounds, cornerRadius: layer.cornerRadius)
shapeLayer.path = path.cgPath
shapeLayer.lineWidth = 1
shapeLayer.fillColor = DSKitAsset.Color.LikeGradient.gradientFirst.color.cgColor
shapeLayer.strokeColor = DSKitAsset.Color.LikeGradient.gradientFirst.color.cgColor

gradientLayer.mask = shapeLayer

// layer.addSublayer(gradientLayer)

layer.insertSublayer(gradientLayer, at: 0)
}
}

0 comments on commit 06d0a47

Please sign in to comment.