Color 익스텐션에서 카테고리 추가 여부 #132
Answered
by
M1zz
Minkyeong-Ko
asked this question in
Q&A
-
|
현재 컬러 팔레트가 Main, System 두 파트로 나눠지는데 바로 색상에 접근할 수도, 카테고리로 접근할 수도 있을 것 같습니다. 색상에 바로 접근하는 경우는 PR 날린 버전인데, extension Color {
static let relaxBlack = Color("RelaxBlack")
static let relaxRealBlack = Color("RelaxRealBlack")
static let relaxNightBlue = Color("RelaxNightBlue")
static let relaxLavender = Color("RelaxLavender")
static let relaxDimPurple = Color("RelaxDimPurple")
static let systemGrey1 = Color("SystemGrey1")
static let systemGrey2 = Color("SystemGrey2")
static let systemGrey3 = Color("SystemGrey3")
}이렇게 정의 후 Color.relaxBlack 이렇게 사용하거나 Color 타입이 확실한 경우엔 .relaxBlack 이렇게도 사용할 수 있습니다. MainColor나 SystemColor로 분리해서 접근하고 싶은 경우 extension Color {
struct MainColor {
static let relaxBlack = Color("RelaxBlack")
static let relaxRealBlack = Color("RelaxRealBlack")
static let relaxNightBlue = Color("RelaxNightBlue")
static let relaxLavender = Color("RelaxLavender")
static let relaxDimPurple = Color("RelaxDimPurple")
}
struct SystemColor {
static let systemGrey1 = Color("SystemGrey1")
static let systemGrey2 = Color("SystemGrey2")
static let systemGrey3 = Color("SystemGrey3")
}
}이렇게 정의한 후 사용할 때는 Color.MainColor.relaxBlack 이렇게 사용해야 합니다. 제 생각에 저희는 현재 색상이 많지 않아서 좀 더 짧게 사용할 수 있는 전자가 괜찮다고 보는데, 다른 분들은 어떻게 생각하시는지 궁금해 디스커션을 남깁니다..! |
Beta Was this translation helpful? Give feedback.
Answered by
M1zz
Aug 4, 2022
Replies: 1 comment
-
|
너무 좋다고 생각합니다. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
M1zz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
너무 좋다고 생각합니다.
이미 정의된 색상 값을 쓰는 것도 좋다고 생각했는데
한 번 더 편해졌어요!