-
Notifications
You must be signed in to change notification settings - Fork 2
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
[#255] YDSLabel SwiftUI로 리팩토링 #261
Conversation
} | ||
var selectedTruncationMode: Text.TruncationMode { | ||
return Text.TruncationMode.allCases[truncationModeSelectedIndex] | ||
} | ||
|
||
public var body: some View { | ||
StorybookPageView(sample: { | ||
VStack { |
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.
VStack은 없어도 될 것 같아요
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.
없애면 string 숨기기 했을 때 텍스트를 담은 뷰가 아예 사라집니다
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.
그렇군요~
struct IntOptionView: View { | ||
struct OptionalIntOptionView: View { |
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.
나중에 optional값이 아닌 Int를 받는 경우가 생길 수도 있으니 기존 IntOptionView는 놔두고 새로 추가하는 것은 어떤가요?
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.
원래 그러려고도 했는데 사용할 때 추가하는 편이 나을 것 같아 일단 뺐습니다!
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.
굿굿굿
lineBreakStrategy: NSParagraphStyle.LineBreakStrategy = .hangulWordPriority) { | ||
public struct YDSLabel: View { | ||
let text: String? | ||
let style: Font |
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.
style이라는 이름은 오해의 소지가 있어 보입니다. 다른 이름을 생각해주세요~
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.
네이밍은 기존 YDS를 참고했습니다~
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.
저도 처음에 style로 했었는데 style이 무슨 스타일을 의미하는지 제대로 네이밍 하는게 좋을 것 같다는 의견이 있어서 알려드렸어요!!
@State var typoStyleSelectedIndex = 0 | ||
@State var lineLimit: Int? = nil |
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.
옵셔널로 선언하면 nil로 초기화를 안해줘도 될 것 같아요
SwiftLint에서도 경고를 띄우네요
@State var lineLimit: Int? = nil | |
@State var lineLimit: Int? |
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.
넵 반영하겠습니다!
📌 Summary
lineLimits
multilineTextAlignment
truncationMode
,allowsTightening
0
은 SwiftUI에서의 lineLimits =nil
과 같아lineLimits의 기본값을 nil로 설정하기 위해
IntOptionView
를OptionalIntOptionView
로 수정하였습니다.✍️ Description
💡 PR Point
📚 Reference
🔥 Test
Simulator Screen Recording - iPhone 15 Pro - 2024-01-16 at 03.56.30.mp4.zip