Skip to content

[DISCUSSION]combine으로 비동기처리를 할때 loadingview 관리를 하는 방법에 대한 의견 #60

Answered by ffalswo2
kimscastle asked this question in Q&A
Discussion options

You must be logged in to vote

저는 후자의 방식이 조금 더 맞다고 생각됩니다.

loadingView도 결국 UIView이고, loadingView를 start시키고 hide시키는건 UI 업데이트하는 쪽에 속한다고 생각됩니다. 따라서 UI를 단순히 업데이트 하는 로직(start, hide) 자체는 UI와 UI로직의 책임을 가지고 있는 ViewController에 있는 것이 더 자연스럽고 있어도 이상하지 않다고 생각합니다. 그리고 ViewController에게 start시킬지 hide시킬지를 명령하는 주체는 결국 ViewModel이기에 해당 loadingView의 state를 따로 저장하진 않지만, loadingView의 state또한 ViewModel이 결정한다고 봐도 무방할 것 같습니다.

저는 이게 loadingView의 로직이 나뉘어졌다고 생각이 들진 않고 오히려 객체가 각자의 책임에 충실하게 해야할 일을 하는 것 같이 느껴집니다.

전자의 경우 loadingView를 start, hide하는 UI업데이트까지의 역할을 수행하고 있어 오히려 ViewController의 책임을 침범하는 느낌이 드는 것 같습니다.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@kimscastle
Comment options

kimscastle Dec 19, 2023
Maintainer Author

@ffalswo2
Comment options

Answer selected by kimscastle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants