Skip to content

Fix/#480 공통여정 답변 상세보기에서 뒤로 가기 클릭 시 공통 여정 탭으로 이동하도록 수정#481

Open
dev-domo wants to merge 2 commits into
developfrom
fix/#480-back
Open

Fix/#480 공통여정 답변 상세보기에서 뒤로 가기 클릭 시 공통 여정 탭으로 이동하도록 수정#481
dev-domo wants to merge 2 commits into
developfrom
fix/#480-back

Conversation

@dev-domo

@dev-domo dev-domo commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

🔗 연결된 이슈

📄 작업 내용

  • 공통여정 답변 상세보기에서 뒤로 가기 클릭 시 공통 여정 탭으로 이동하도록 수정
구현 내용 IPhone 16 pro IPhone 13 mini
GIF

✅ Testing

  • 테스트 목적과 상황
    공통 여정 답변 상세보기에서 뒤로 가기 클릭
  • 시나리오 진행에 필요한 조건
    공통 여정 관련 알림을 탭하여 -> 공통 여정 답변 상세보기로 이동한 후 -> 뒤로 가기를 클릭한다.
    홈에서 퀘스트 탭을 클릭하고 -> 공통 여정 탭바를 클릭한 후 -> 공통 여정 답변 상세보기로 이동한 후 -> 뒤로 가기를 클릭한다.
  • 시나리오 완료 시 보장하는 결과
    공통 여정 답변 상세보기에서 뒤로 가기 클릭 시 공통 여정 탭으로 이동한다.

💻 주요 코드 설명

ParentQuestViewController

  • 퀘스트 탭에서 <나의 여정> 혹은 <공통 여정> 탭을 누르면 ParentQuestViewController의 bind 메서드가 호출됩니다.
  • bind 메서드에서는 사용자가 클릭한 탭의 인덱스를 인식하여 올바른 탭을 보여줍니다.
  • 이때 bind 메서드에서 selectedIndex를 사용자가 실제로 탭한 인덱스로 초기화하지 않는 것이 문제가 되었습니다.
  • 더불어, 퀘스트 탭에서 다른 탭으로 갔다가 다시 퀘스트 탭으로 돌아왔을 때는 <나의 여정>이 선택되어있어야 합니다.
  • 이에 따라 아래와 같이 코드를 수정했습니다. (주석 참고)
final class ParentQuestViewController<T: QuestTabItem> {

    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        
        // 다른 뷰로의 push가 아닌 다른 탭으로 전환한 경우에만 selectedIndex를 0으로 초기화
        if navigationController?.topViewController === self {
            selectedIndex = 0
        }
    }

    private func bind() {
        tabBar.didTap = { [weak self] index in
            guard let self,
                  index >= 0 && index < controllers.count
            else {
                return
            }
            selectedIndex = index    // 사용자가 탭했을 때 selectedIndex 업데이트
            show(controllers[index])
        }
    }
}

@dev-domo
dev-domo requested review from juri123123 and y-eonee July 26, 2026 16:39
@dev-domo dev-domo self-assigned this Jul 26, 2026
@dev-domo dev-domo added the fix 버그나 오류 해결 label Jul 26, 2026
@dev-domo dev-domo changed the title Fix: #480 공통여정 답변 상세보기에서 뒤로 가기 클릭 시 공통 여정 탭으로 이동하도록 수정 Fix/#480 공통여정 답변 상세보기에서 뒤로 가기 클릭 시 공통 여정 탭으로 이동하도록 수정 Jul 26, 2026
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

유효한 탭을 클릭하면 화면 전환 전에 selectedIndex가 클릭된 인덱스로 갱신됩니다.

Changes

탭 선택 상태 동기화

Layer / File(s) Summary
탭 선택 인덱스 갱신
ByeBoo-iOS/.../ParentQuestViewController.swift
유효한 탭 인덱스를 검증한 뒤 화면 전환 전에 selectedIndex를 해당 인덱스로 설정합니다.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: juri123123, y-eonee

Poem

토끼가 탭을 톡 누르면
선택 인덱스 깡충 갱신
화면도 함께 폴짝 전환
당근처럼 딱 맞는 흐름
깡총! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 공통 여정 상세보기에서 뒤로 가기 시 선택한 탭으로 돌아가도록 하는 변경을 잘 요약합니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/#480-back

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment on lines 28 to +45
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true)
tabBarController?.tabBar.isHidden = false

guard controllers.indices.contains(selectedIndex) else { return }

show(controllers[selectedIndex])
tabBar.select(index: selectedIndex)
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)

if navigationController?.topViewController === self {
selectedIndex = 0
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

요거 viewDidLoad 뒤로 갈 수 있도록 수정 부탁드립니다 ! 실행 순서대로 함수가 나열되어 있어야 가독성이 올라갈 것 같아요 ㅎㅎ

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

앗 좋습니다! 수정할게요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix 버그나 오류 해결 승준🤠

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] 공통 여정 상세 보기에서 뒤로 가기 클릭 시 나의 여정으로 이동하는 오류 해결

2 participants