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

fix: 명함 공유 뷰 수정 (#349) #350

Merged
merged 27 commits into from
Jan 31, 2023
Merged

fix: 명함 공유 뷰 수정 (#349) #350

merged 27 commits into from
Jan 31, 2023

Conversation

hyun99999
Copy link
Member

@hyun99999 hyun99999 commented Jan 19, 2023

🌴 PR 요약

🌱 작업한 브랜치

Lottie 와 json 파일 및 이미지 에셋을 사용하기 위함. 해당 이슈의 풀리케가 머지된 후에 보시면 좀 더 깔끔하실 거에용

🌱 작업한 내용

  • 명함 공유 뷰 수정.
    • 로티 추가.
    • UISwitch 에 따라서 UI 변경.
    • 바텀시트의 높이가 변경되었습니다.

스크린샷 2023-01-19 오후 3 49 35

  • UIView 를 추가할 때 addSubviews(_:) 메서드를 만들어서 배열로 용이하게 추가하도록 하였습니다.

🚨 참고사항

구현 영상

  • 녹화 영상에서 두번째 시뮬레이터는 활성화된 명함의 경우 명함 공유 바텀시트를 띄우면 활성화가 유지되어야하기 때문에 변수를 수정하여서 적용한 것입니다.
    • 활성화 상태에서 로티가 무한반복되도록 요청하여서 반영하였습니당

코드

  • 현재 바텀시트를 등장시킬 때 isActivate 변수값을 false 로 설정하고 있는데 이는 추후에 대응해주면 되겠습니다.
  • 접근 제어자 및 주석과 빈 줄을 수정하였습니다.
  • UI 를 isActivate 변수에 따라서 처리해야할 때 if 문 대신에 삼항 연산자를 사용하였습니다.
    • if 문을 사용하게 되면 else 에서 동일한 components 에 대응해줘야 하기 때문에 줄이 두배 길어지고, 삼항연산자 사용하면 UI components 에 코드가 집중할 수 있다고 생각했습니다.
    • if-else 문에서 휴먼에러로 UI components 를 변경하는 코드를 놓치지 않을 수 있습니다.

lazy

  • lottie 의 경우 활성화되지 않았을 때는 사용되는 것이 불필요하기 때문에 lazy 로 선언해서 lottie image 를 사용하기 전까지 메모리에 올리지 않게 하였습니다.

SwiftLint

  • SwiftLint 에서 self_in_property_initialization 워닝을 제거하였습니다.
    • 아직 선언되지 않은 컴포넌트의 액션 메서드를 적용하기 위해서 addTarget() 에서 self 를 사용하면 이는 예상못할 수 있기 때문에 lazy 하게 만들어야 안전합니다.

    출처: https://realm.github.io/SwiftLint/self_in_property_initialization.html

📸 스크린샷

기능 스크린샷
명함 공유 바텀시트

📮 관련 이슈

- layout 작업 시에 UIView 배열로 뷰에 더하는 함수 생성.
- if 문을 사용하게 되면 줄이 두배 길어지고, 삼항연산자 사용하면 UI components 에 코드가 집중할 수 있다고 생각했습니다.
- if-else 문에서 휴먼에러로 변경되는 UI 를 놓치지 않을 수 있습니다.
- 추후에 수정되어야 하기 때문에 주석 설정.
- lazy 로 선언해서 lottie image 를 사용하기 전까지 메모리에 올리지 않게 됨.
- 아직 선언되지 않은 컴포넌트의 액션 메서드를 적용하기 위해서 addTarget() 에서 self 를 사용하면 이는 예상못할 수 있기 때문에 lazy 하게 만들어야 안전합니다.
@hyun99999 hyun99999 added Hyungyu 🐯 현규 교수님 작업 Fix 코드 수정 및 버그, 오류 해결 labels Jan 19, 2023
@hyun99999 hyun99999 self-assigned this Jan 19, 2023
Copy link
Member

@dlwns33 dlwns33 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다 선생님! 기기 대응되니까 훨씬 더 보기 좋네요 !

Comment on lines +167 to +182
cardBackgroundView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
cardBackgroundView.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 20.0),
cardBackgroundView.leadingAnchor.constraint(equalTo: bottomSheetView.leadingAnchor, constant: 24.0),
cardBackgroundView.trailingAnchor.constraint(equalTo: bottomSheetView.trailingAnchor, constant: -24.0),
cardBackgroundView.heightAnchor.constraint(equalToConstant: 384.0)
])

nadaLogoImage.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
nadaLogoImage.topAnchor.constraint(equalTo: cardBackgroundView.topAnchor, constant: 18.0),
nadaLogoImage.leadingAnchor.constraint(equalTo: cardBackgroundView.leadingAnchor, constant: 18.0),
nadaLogoImage.widthAnchor.constraint(equalToConstant: 84.0),
nadaLogoImage.heightAnchor.constraint(equalToConstant: 30.0)
])

Copy link
Member

Choose a reason for hiding this comment

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

와우 이거 스냅킷 안쓰시고 하셨군요...

Copy link
Member Author

Choose a reason for hiding this comment

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

놀랍게도 이 프로젝트는 스냅킷이 인스톨되어있지 않아요 ㅋㅋㅋㅋㅋ 우리가 그때 없이 해보자고 한거 같아여
불편하면 추가해도 좋아요!

…ease into feature/#349

# Conflicts:
#	NADA-iOS-forRelease.xcodeproj/project.pbxproj
@hyun99999 hyun99999 merged commit 6e65fb0 into develop Jan 31, 2023
@hyun99999 hyun99999 deleted the feature/#349 branch January 31, 2023 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix 코드 수정 및 버그, 오류 해결 Hyungyu 🐯 현규 교수님 작업
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: 명함 공유 뷰 수정
2 participants