-
Notifications
You must be signed in to change notification settings - Fork 0
인디케이터 #13
Copy link
Copy link
Open
Description
SearchViewController에서는 loadingIndicator라는 UIActivityIndicatorView를 정의하고, 이를 사용하여 로딩 상태를 시각적으로 표시합니다.
보여지게될 LodingIndicator 선언 및 세팅
private lazy var loadingIndicator: UIActivityIndicatorView = {
let indicator = UIActivityIndicatorView(style: .large)
return indicator.then {
$0.color = .black
$0.hidesWhenStopped = true
}
}()bind 메서드를 사용하여 SearchReactor의 isLoading 상태를 관찰
상태 변화에 따라 loadingIndicator의 애니메이션을 시작하거나 숨김
reactor.state
.map { $0.isLoading }
.distinctUntilChanged()
.bind(to: loadingIndicator.rx.isAnimating)
.disposed(by: disposeBag)reactor.state
.map { !$0.isLoading }
.distinctUntilChanged()
.bind(to: loadingIndicator.rx.isHidden)
.disposed(by: disposeBag) SearchReactor에서는 .search, .loadNextPage, .selectRarity 등의 액션 처리 시 setLoading 뮤테이션을 사용하여 로딩 상태를 업데이트합니다. 각 액션에 따라 API 요청 전후로 로딩 상태를 적절히 설정하여 사용자에게 로딩 중임을 알림
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels