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

Feat [#42] CreateChallenge view 생성 및 버튼 활성화 로직 구현 #45

Merged
merged 6 commits into from
Jan 10, 2024

Conversation

kim-seonwoo
Copy link
Member

@kim-seonwoo kim-seonwoo commented Jan 10, 2024

👾 작업 내용

  • CreateChallenge 및 온보딩 단계에서 사용되는 UI의 구현을 완료 했습니다!

  • 각 viewController를 생성하고, push, pop을 연결하였습니다.

  • 버튼 활성화 관련 로직을 추가 하였습니다.

protocol HMHSelectButtonDelegate: AnyObject {
    func updateAvailability(isEnabled: Bool)
}

버튼 이벤트 발생시 다음 함수를 호출하여 bool값을 전달합니다.

    func setAvailability() {
        if (superview?.subviews.compactMap { ($0 as? HMHSelectButton)?.isChecked } ?? []).filter { $0 }.count == 0 {
            updateAvailability(status: false)
        } else {
            updateAvailability(status: true)
        }
    }

}
  • 실행하는 뷰 컨트롤러에서 다음과 같이 가져와서 사용합니다.
    extension TimeSurveyViewController: HMHSelectButtonDelegate {
    func updateAvailability(isEnabled: Bool) {
        nextButton.updateStatus(isEnabled: isEnabled)
    }
}
  • 피커뷰 관련 버튼 활성화 로직을 추가하였습니다.
  • TotalTimePickerView에 프로토콜을 추가하였습니다.
  protocol TotalTimePickerDelegate: AnyObject {
      func updateAvailability()
  }

pickerView에서 값을 변화하여 값이 생길때 함수를 호출합니다.

    func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
        self.reloadComponent(component)
        self.totalTimePickerDelegate?.updateAvailability()
    }
  }
  • 사용하는 뷰컨트롤러에서 다음과 같이 사용합니다.
extension SelectTotalTimeController: TotalTimePickerDelegate {
    func updateAvailability() {
        nextButton.updateStatus(isEnabled: true)
    }
}
  • stringLiteral에서 왼쪽으로 정렬되면서 height를 잡아주는 함수를 생성하였습니다.

🚀 PR Point

  • 상속 관계가 복잡한데, 이벤트에 따른 처리를 하려면 Delegate를 쓰는게 좋은 것 같아요~!
  • 권한 허용 관련 로직을 추가하면 될 것 같습니다!

📸 스크린샷

구현 내용 스크린샷
온보딩 Simulator Screen Recording - iPhone 13 mini - 2024-01-10 at 16 40 14

🚀 기기 대응

기기명 Iphone 13 mini Iphone 14 Iphone 15 pro Iphone SE(3rd)
파일첨부바람 image image image image

✅ Issue

Resolved #42

@kim-seonwoo kim-seonwoo added 😎선우 선우의 issue 🌈 feat 기능 구현 labels Jan 10, 2024
@kim-seonwoo kim-seonwoo added this to the 🚀1차 스프린트🚀 milestone Jan 10, 2024
@kim-seonwoo kim-seonwoo self-assigned this Jan 10, 2024
@kim-seonwoo kim-seonwoo linked an issue Jan 10, 2024 that may be closed by this pull request
Copy link
Member

@Zoe0929 Zoe0929 left a comment

Choose a reason for hiding this comment

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

P5. LGTM 🔥🔥

@kim-seonwoo kim-seonwoo merged commit f820cd4 into develop Jan 10, 2024
@kim-seonwoo kim-seonwoo deleted the feat/#42-CreateChallenge branch January 12, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌈 feat 기능 구현 😎선우 선우의 issue
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Feat] 챌린지 생성 UI 구현
2 participants