-
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
[#27] HandyList 제작 #28
Conversation
let label = HandyLabel() | ||
label.style = .B1Rg16 | ||
label.textColor = HandySemantic.textBasicPrimary | ||
label.textAlignment = .left |
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.
textAlignment의 기본값이 left인데
이렇게 코드로 명시적으로 표현
해주는게 좋을까요?
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.
항상 왼쪽으로만 정렬되어 있어야 한다면 명시적으로 표현해주는 것도 괜찮죠!
나중을 생각해보면, 이 기본값이 바뀔 때 HandyList에서의 기본 값도 바뀌어야 한다면 오히려 지정하지 않는게 더 좋을 수도 있다고 생각해요!
예를 들어, 아랍권에서 label이 오른쪽에서 왼쪽으로 써질 때, textAlignment 역시 오른쪽으로 바뀌어야 할 것 같아요!
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.
그렇군요 생각하지 못한 부분이에요! 근데 예시로 들어주신 경우 보다는 나중에 유지보수를 하는 사람들이나 핸디를 사용하는 사람들한테 보다 직관적으로 보여주는게 더 중요하다고 생각되네요!
final public class HandyList: UIView { | ||
|
||
/** | ||
HandyList 요소들을 담는 StackView | ||
*/ | ||
|
||
private let stackView: UIStackView = { | ||
let stackView = UIStackView() | ||
stackView.axis = .vertical | ||
stackView.distribution = .fill | ||
stackView.spacing = 0 | ||
return stackView | ||
}() | ||
|
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.
StackView로 설계하신 이유가 궁금해요!! HandyListItem을 cell로 등록된 tableView나 collectionView같은 요소도 충분히 고려할만 하다고 생각해서요!
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.
리스트 아이템의 개수가 많아지면 뷰 로딩이나 사용하는 메모리 측면에서 단점이 생길 수 있다고 생각되지만, 이런 유스케이스라면 굳이 cell을 따로 지정하는 방식 보다는 스택 뷰도 일리가 있겠네요!!
📌 Summary
✍️ Description
💡 PR Point
📚 Reference
🔥 Test