From 00d03f94ddb901122958efa015a677353116a3e1 Mon Sep 17 00:00:00 2001 From: Yurim Kim Date: Tue, 22 Oct 2024 18:29:28 +0900 Subject: [PATCH] [Add] #6 - (Reusables) BorderView --- .../Week2/Reusables/BorderView.swift | 42 +++++++++++++++---- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/35-seminar/Presentation/Week2/Reusables/BorderView.swift b/35-seminar/Presentation/Week2/Reusables/BorderView.swift index 5465850..4dbd36f 100644 --- a/35-seminar/Presentation/Week2/Reusables/BorderView.swift +++ b/35-seminar/Presentation/Week2/Reusables/BorderView.swift @@ -6,15 +6,41 @@ // import UIKit +import SnapKit class BorderView: UIView { - - /* - // Only override draw() if you perform custom drawing. - // An empty implementation adversely affects performance during animation. - override func draw(_ rect: CGRect) { - // Drawing code + + // MARK: - Properties + let grayLine = UIView() + + override init(frame: CGRect) { + super.init(frame: frame) + setUI() + setHierarchy() + setConstraints() + } + + required init(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func setUI() { + self.backgroundColor = .none + grayLine.backgroundColor = .separator + } + + private func setHierarchy() { + self.addSubview(grayLine) + } + + private func setConstraints() { + self.snp.makeConstraints { + $0.height.equalTo(1) + } + + grayLine.snp.makeConstraints { + $0.height.equalTo(1) + $0.horizontalEdges.equalToSuperview().inset(20) + } } - */ - }