Skip to content

Conversation

@youn9k
Copy link
Member

@youn9k youn9k commented Nov 19, 2024

🤔 배경

이번 주 데모에서 화면을 사용하기 위해 빠르게 구현했습니다.

📃 작업 내역

  • 관갔던 PTGMicButton 원상복구
  • 관갔던 tapPublisher 원상복구
  • WaitingRoomViewModel 추가
  • WaitingRoomViewController 추가
  • WaitingRoomView 추가
  • CollectionViewCell 버그 수정

✅ 리뷰 노트

기존에 작성된 뷰모델 코드들과 컨벤션을 맞추기 위해 Input, Output 패턴을 적용하고, 단방향 플로우와 가독성을 신경썼습니다.

struct Input {
        let micMuteButtonDidTap: AnyPublisher<Void, Never>
        let shareButtonDidTap: AnyPublisher<Void, Never>
        let startButtonDidTap: AnyPublisher<Void, Never>
    }

    struct Output {
        let micMuteState: AnyPublisher<Bool, Never>
        let shouldShowShareSheet: AnyPublisher<String, Never>
        let navigateToPhotoRoom: AnyPublisher<Void, Never>
    }
    
    func transform(input: Input) -> Output {
        let newMicMuteState = mutateMicMuteButtonDidTap(input)
        let newShouldShowShareSheet = mutateShareButtonDidTap(input)
        let newNavigateToPhotoRoom = mutateStartButtonDidTap(input)
        
        let output = Output(
            micMuteState: newMicMuteState,
            shouldShowShareSheet: newShouldShowShareSheet,
            navigateToPhotoRoom: newNavigateToPhotoRoom
        )
        
        return output
    }
    

사용하는 곳에선 아래와 같이 바인딩하여 사용할 수 있습니다.

viewDidLoad() {
    ...
    bindOutput()
}

func createInput() -> WaitingRoomViewModel.Input {
    return WaitingRoomViewModel.Input(
        micMuteButtonDidTap: waitingRoomView.micButton.tapPublisher          
        shareButtonDidTap: waitingRoomView.shareButton.tapPublisher,
        startButtonDidTap: waitingRoomView.startButton.tapPublisher
    )
}

func bindOutput() {
    let output = viewModel.transform(input: createInput())
        
    output.navigateToPhotoRoom.sink { _ in
        print("navigateToPhotoRoom 버튼이 눌렸어요!")
    }.store(in: &cancellables)
}

🎨 스크린샷

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

🚀 테스트 방법

WaitingRoomFeatureDemo 를 실행하면 확인하실 수 있습니다!
드디어 테스트를..

youn9k and others added 17 commits November 18, 2024 19:25
마이크 이미지 추가 및 이미지 변경 기능 추가
- UIControl을 상속받는 객체 또한 controlPublihser를 통해서 UIControl.Event에 대한 모든 퍼블리셔를 만들 수 있습니다.
- UIButton을 상속받는 모든 객체는 tapPublisher를 확장하여 사용할 수 있습니다.

Co-Authored-By: YeongHoon Song <[email protected]>
@youn9k youn9k added the ✨ feat 새로운 기능 추가 label Nov 19, 2024
@youn9k youn9k self-assigned this Nov 19, 2024
@youn9k youn9k linked an issue Nov 19, 2024 that may be closed by this pull request
4 tasks
Copy link
Member

@Kiyoung-Kim-57 Kiyoung-Kim-57 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

@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 💯

몇가지 궁금한 점들을 적어놨는데 나중에 코멘트 한번만 부탁드립니다 🫡

수고 많으셨습니다!

@youn9k youn9k merged commit cefb0a9 into develop Nov 20, 2024
1 check passed
@youn9k youn9k deleted the feat/#50-waiting-room-ui branch November 20, 2024 04:35
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