-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat] #21 - 공통 버튼 구현 #27
Changes from 11 commits
25cb7ee
73cff38
098f698
178612f
089748f
43da7eb
efe6e4f
3625b3f
5b06e7d
2d42919
eec7b7c
d048ebe
b7f8010
22baf7f
f13fcf4
d019a52
a7087c3
1a14877
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// | ||
// Protocol.swift | ||
// GEON-PPANG-iOS | ||
// | ||
// Created by JEONGEUN KIM on 2023/07/09. | ||
// | ||
|
||
import Foundation |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// | ||
// CommonButton.swift | ||
// GEON-PPANG-iOS | ||
// | ||
// Created by JEONGEUN KIM on 2023/07/06. | ||
// | ||
|
||
import UIKit | ||
|
||
import SnapKit | ||
import Then | ||
|
||
enum ButtonTitle: String, CaseIterable { | ||
|
||
case login = "로그인" | ||
case signIn = "회원가입" | ||
case next = "다음" | ||
case confirm = "확인" | ||
case duplicate = "중복 확인" | ||
case write = "작성하기" | ||
case start = "시작하기" | ||
|
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: |
||
|
||
final class CommonButton: UIButton { | ||
|
||
// MARK: - Property | ||
// MARK: = UI Property | ||
|
||
init() { | ||
super.init(frame: .zero) | ||
|
||
setUI() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
// MARK: - Setting | ||
|
||
private func setUI() { | ||
makeCornerRound(radius: 11) | ||
titleLabel?.font = .pretendardMedium(18) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q: |
||
|
||
func setButtonTitle(_ title: ButtonTitle) { | ||
setTitle(title.rawValue, for: .normal) | ||
} | ||
|
||
func setButtonUI(_ color: UIColor, _ border: UIColor? = .clear) { | ||
self.backgroundColor = color | ||
|
||
switch color { | ||
case .gbbMain3!, .gbbGray700!: setTitleColor(.gbbGray100, for: .normal) | ||
case .gbbMain2!: setTitleColor(.white, for: .normal) | ||
default: | ||
setTitleColor(.gbbGray400, for: .normal) | ||
} | ||
|
||
if let border = border { | ||
makeBorder(width: 1, color: border) | ||
if border != .clear { | ||
setTitleColor(border, for: .normal) | ||
} | ||
} | ||
} | ||
|
||
func setAction(completion: ((UIAction) -> Void)? = nil) { | ||
let action = UIAction { action in | ||
completion?(action) | ||
} | ||
addAction(action, for: .touchUpInside) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q: 오늘부터 합숙 시작하니까, 논의해보면 좋을 것 같아요 !! |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1:
"중복확인" 으로 변경 부탁드려요 !
띄어쓰기가 없어야 하는 것 같숩니다 !