Skip to content

Conversation

@Kiyoung-Kim-57
Copy link
Member

🤔 배경

  1. 본격 네트워크 개발 전 빠르게 UI를 구현했습니다.

📃 작업 내역

  1. Photo Room UI 호스트 게스트 화면 구현
  2. 뷰모델에서 버튼 액션 Input에 따른 Output 전달
  3. 호스트가 카메라 버튼 누르면 타이머 보임(아직 게스트에선 적용 안됨)

✅ 리뷰 노트

  1. PhotoRoomViewModel에서 카메라 버튼 액션의 Input Output을 설정했습니다.
class PhotoRoomViewModel {
     ...
    enum Input {
        case cameraButtonTapped
    }
    
    enum Output {
        case timer(count: Int)
        case timerCompleted
    }
    
    private var output = PassthroughSubject<Output, Never>()
    
    func transform(input: AnyPublisher<Input, Never>) -> AnyPublisher<Output, Never> { }
    
    private func startTimer() {  } //timer output을 전달하고 Timer가 끝나면 timerCompleted output 전달
}
  1. PhotoRoomViewController의 생성자에서 isHost Bool 값을 전달받아 호스트 뷰와 게스트 뷰를 생성합니다
  • isHost 값을 PhotoRoomViewController 내부의 PhotoRoomBottomView, 그리고 그 내부의 CameraButton에 각각 전달해서 호스트와 게스트를 구분합니다.
PhotoRoomViewController(isHost: true)
PhotoRoomBottomView(isHost: isHost) //PhotoRoomViewController 내부에 자식뷰로 있음
CameraButton(isHost: isHost) //PhotoRoomBottomView 내부에 자식뷰로 있음
  1. throttle을 이용해서 카메라 연속 터치해도 타이머가 연속으로 호출되지 않도록 했습니다.
// PhotoRoomBottomView.swift
cameraButton.tapPublisher
    .throttle(for: .seconds(Constants.throttleTime), scheduler: RunLoop.main, latest: false)
    .eraseToAnyPublisher()

🎨 스크린샷

iPhone SE(2세대) iPhone 14 iPhone 16 Pro Max

🚀 테스트 방법

  1. PhotoRoomFeatureDemo에서 PhotoRoomViewController의 생성자에 isHost를 true로 하면 호스트, false면 게스트 화면을 테스트 할 수 있습니다.
  2. 호스트 화면에서 카메라 버튼을 누르면 타이머가 진행됩니다.

- 필터 아이콘 추가
- 카메라 전환 아이콘 추가
- PTGImage에 해당 아이콘들 case 추가
- 카메라 버튼 구현
- 카메라 버튼 터치 시 색상 변경 구현
- Constants의 버튼 사이즈는 카메라 버튼 객체 생성하는 위치에서 사용해야하기에 internal로 접근 제어자 설정
- PhotoRoom Host BottomView 구현
- 상수 부분 이후 따로 extension에 정적 변수로 관리 예정
- 상수 추후 extension에서 정적 변수로 관리 예정
- 안쓰는 케이스인줄 알고 지웠던 temp1, temp2 case 복구
- 기존 카메라 버튼에 Bool 값을 추가해 호스트와 게스트에 따라 모양이 바뀌도록 했습니다
- isHost 변수를 통해 호스트 게스트 구분
- 둘이 동시에 사용할 수 있으니 파일 이름 변경
- 화질구린 이미지 svg로 변경했습니다.
- 카메라 누르면 input이 전달되어 뷰 모델에 input 전달
- timer output이 뷰로 전달
- 타이머가 끝나면 뷰모델에서 timerCompleted output 전달
- 그 외 상수 extension으로 따로 분리
- init에 true를 넣으면 호스트, false는 게스트로 UI 테스트 가능
@Kiyoung-Kim-57 Kiyoung-Kim-57 added the ✨ feat 새로운 기능 추가 label Nov 19, 2024
@Kiyoung-Kim-57 Kiyoung-Kim-57 self-assigned this Nov 19, 2024
@Kiyoung-Kim-57 Kiyoung-Kim-57 linked an issue Nov 19, 2024 that may be closed by this pull request
6 tasks
Copy link
Collaborator

@hsw1920 hsw1920 left a comment

Choose a reason for hiding this comment

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

코멘트 남겼습니다 고생하셨어요!

Copy link
Collaborator

@0Hooni 0Hooni left a comment

Choose a reason for hiding this comment

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

LGTM 💯

수고 많으셨습니다!!

@Kiyoung-Kim-57 Kiyoung-Kim-57 merged commit 328428b into develop Nov 20, 2024
1 check passed
@Kiyoung-Kim-57 Kiyoung-Kim-57 deleted the feat/#44-host-photo-room-ui branch November 20, 2024 08:36
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.

호스트 촬영 화면 UI를 구현한다

5 participants