-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [#13] HandyFab 생성 * [#18] HandyDivider 생성 * [#13] 1차 코드 리뷰 반영 * [#18] 불필요 height, Vertical Divider 삭제 * Chip * [#8] chipViewController 생성 * [#8] ViewDidLoad 삭제 * [#8] SnapKit으로 정리, icon추가 * [#8] icon추가, 주석 정리 * [#8] icon 색상 지정 * ChipViewController SnapKit 문법 수정 * [#8] rebase conflict 및 package 에러 해결 * [#18] HandyDivider 생성 * [#18] 불필요 height, Vertical Divider 삭제 * [#18] rebase conflict 해결 * [#18] package.resolved 업로드 --------- Co-authored-by: wjdalswl <[email protected]> Co-authored-by: LeeJoEun-01 <[email protected]>
- Loading branch information
1 parent
5c05a43
commit 7cf0deb
Showing
4 changed files
with
150 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// | ||
// DividerViewController.swift | ||
// Handy-Storybook | ||
// | ||
// Created by 서준영 on 9/15/24. | ||
// | ||
|
||
import Handy | ||
import UIKit | ||
import SnapKit | ||
|
||
class DividerViewController: BaseViewController { | ||
|
||
//MARK: - 프로퍼티 선언 | ||
let divider1: HandyDivider = { | ||
let divider = HandyDivider() | ||
divider.thickness = .thickness1 | ||
return divider | ||
}() | ||
|
||
let divider2: HandyDivider = { | ||
let divider = HandyDivider() | ||
divider.thickness = .thickness2 | ||
return divider | ||
}() | ||
|
||
let divider4: HandyDivider = { | ||
let divider = HandyDivider() | ||
divider.thickness = .thickness4 | ||
return divider | ||
}() | ||
|
||
let divider8: HandyDivider = { | ||
let divider = HandyDivider() | ||
divider.thickness = .thickness8 | ||
return divider | ||
}() | ||
|
||
//MARK: - 뷰에 추가 | ||
override func setViewHierarchies() { | ||
self.view.backgroundColor = .black | ||
self.view.addSubview(divider1) | ||
self.view.addSubview(divider2) | ||
self.view.addSubview(divider4) | ||
self.view.addSubview(divider8) | ||
} | ||
|
||
//MARK: - 레이아웃 배치 | ||
override func setViewLayouts() { | ||
divider1.snp.makeConstraints { | ||
$0.width.equalTo(375) | ||
$0.centerX.equalToSuperview() | ||
$0.top.equalTo(self.view.snp.top).offset(300) | ||
} | ||
|
||
divider2.snp.makeConstraints { | ||
$0.width.equalTo(375) | ||
$0.centerX.equalToSuperview() | ||
$0.top.equalTo(divider1.snp.bottom).offset(20) | ||
} | ||
|
||
divider4.snp.makeConstraints { | ||
$0.width.equalTo(375) | ||
$0.centerX.equalToSuperview() | ||
$0.top.equalTo(divider2.snp.bottom).offset(20) | ||
} | ||
|
||
divider8.snp.makeConstraints { | ||
$0.width.equalTo(375) | ||
$0.centerX.equalToSuperview() | ||
$0.top.equalTo(divider4.snp.bottom).offset(20) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// | ||
// HandyDivider.swift | ||
// Handy | ||
// | ||
// Created by 서준영 on 9/15/24. | ||
// | ||
|
||
import UIKit | ||
import SnapKit | ||
|
||
public class HandyDivider: UIView { | ||
|
||
public enum DividerThickness { | ||
case thickness1 | ||
case thickness2 | ||
case thickness4 | ||
case thickness8 | ||
|
||
fileprivate var rawValue: CGFloat { | ||
switch self { | ||
case .thickness1: | ||
return 1 | ||
case .thickness2: | ||
return 2 | ||
case .thickness4: | ||
return 4 | ||
case .thickness8: | ||
return 8 | ||
} | ||
} | ||
} | ||
|
||
@Invalidating(.layout) public var thickness: DividerThickness = .thickness1 { | ||
didSet { | ||
setNeedsUpdateConstraints() | ||
} | ||
} | ||
|
||
public override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
setupView() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
private func setupView() { | ||
setColor() | ||
setThickness() | ||
} | ||
|
||
private func setColor() { | ||
self.backgroundColor = HandySemantic.bgBasicStrong | ||
} | ||
|
||
override public func updateConstraints() { | ||
super.updateConstraints() | ||
setThickness() | ||
} | ||
|
||
private func setThickness() { | ||
self.snp.updateConstraints { | ||
$0.height.equalTo(thickness.rawValue) | ||
} | ||
} | ||
} |