-
Notifications
You must be signed in to change notification settings - Fork 0
컴바인 과제 #4
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
base: main
Are you sure you want to change the base?
Conversation
y-eonee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
깔끔하네요
| extension MovieAPI { | ||
|
|
||
| private enum Constants { | ||
| static let apiKey = "1e0e28f5603a7ff6e4038ebd37d0fdd7" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요거는 컨피그로 옮기면 좋을것같아요
| final class MovieViewModel { | ||
|
|
||
| let movies = PassthroughSubject<[MovieAPI.DailyBoxOffice], Never>() | ||
| let isLoading = PassthroughSubject<Bool, Never>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
와우 로딩중~~
| func updateLoading(isLoading: Bool) { | ||
| if isLoading { | ||
| loadingIndicator.startAnimating() | ||
| } else { | ||
| loadingIndicator.stopAnimating() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굿
학습 내용
영화진흥위원회 open api를 mvvm + combine으로 연결
핵심 코드
뷰컨트롤러가 load 되면, bind 함수를 호출하고,
영화 목록을 가져오면 테이블 뷰가 업데이트 됩니다.
뷰 모델에서는, load()를 통해 영화를 불러오고, send() 합니다.
우선 영화 목록을 불러오기 전까지는 로딩 상태를 유지하고, 영화 목록을 성공적으로 받아왔다면 이를 내보내고 로딩을 해제합니다.
네트워크 연결은 다음과 같이 구성했습니다.
시연 영상