Skip to content
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

[#19] HandySwitch 생성 #23

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

[#19] HandySwitch 생성 #23

wants to merge 21 commits into from

Conversation

LeeJoEun-01
Copy link
Contributor

📌 Summary

Switch 컴포넌트를 만들었습니다.
근데 원래 Switch는 특정한 크기로 크기를 변환할 수 없습니다.
그 대신 크기 비율을 조절할 수 있어서 비율을 설정하여 크기를 변화시키도록 하였습니다.

✍️ Description

closed: #19

💡 PR Point

비율로 크기 조절을 하였는데
해당 Switch 요소를 VC에서 만들어서 사용하면 원래 크기를 기준으로 레이아웃이 적용됩니다.
그래서 지금은 원래 위치에서 특정값을 마이너스하여 위치를 조정하였습니다.

다른 컴포넌트 만들고 해당 문제 다시 해결해보겠습니다!!! 혹시 문제 원인을 아시는 분들은 댓글에 남겨주세요!

📚 Reference

🔥 Test

Simulator Screen Recording - iPhone 14 - 2024-10-09 at 09 49 26

@LeeJoEun-01 LeeJoEun-01 added the feat 💜 새로운 기능 구현 label Oct 9, 2024
@LeeJoEun-01 LeeJoEun-01 self-assigned this Oct 9, 2024
@LeeJoEun-01 LeeJoEun-01 changed the title [#19] Switch 생성 [#19] HandySwitch 생성 Oct 9, 2024
jysuhr and others added 17 commits October 9, 2024 10:31
* [#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 <109158284+wjdalswl@users.noreply.github.com>
Co-authored-by: LeeJoEun-01 <joeun1005@naver.com>
Comment on lines +12 to +19
// MARK: - 외부에서 지정할 수 있는 속성
@Invalidating(.layout, .display) public var isDisabled: Bool = false

@Invalidating(.display) public var size: SwitchSize = .medium {
didSet {
updateSwitchSize() // size가 변경될 때 크기 변경
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Invalidating을 사용하신 이유가 궁금합니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

먼저, @invalidating는 프로퍼티 값이 변경되었음을 감지하게 해주는 기능입니다.

기존의 YDS-Storybook처럼 Handy-Storybook도 만들 예정인데 이때 컴포넌트의 특정 옵션을 변경할때마다 스토리북에 보여지는 컴포넌트를 다시 그리기 위해 사용했습니다!


import UIKit

public class HandySwitch: UISwitch {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HandySwitch를 상속 할 일이 없다면 final 붙여도 되지 않을까요? @


final class HansySwitchViewController: BaseViewController {

let switch1: HandySwitch = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헉 private, final 다음부터는 더 신경쓰도록 하겠습니다!
코드리뷰 감사합니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat 💜 새로운 기능 구현
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] HandySwitch 만들기
5 participants