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

[Team-13 iOS Neo] redux 구조 변경 #54

Open
wants to merge 3 commits into
base: team-13
Choose a base branch
from

Conversation

HoonHaChoi
Copy link

@HoonHaChoi HoonHaChoi commented Jul 26, 2021

로그인 뷰 컨트롤러는 성공했다는 이벤트만 필요했기에 상태를 만들지 않고
클로저로 액션만 전달 하도록 변경했습니다

로그인 코디네이터 또한 이벤트만 전달만 하면 되기 때문에 클로저로 액선만 전달하도록 변경했고
앱코디네이터가 상태를 가지고 상태에 따라 화면이 변경되도록 수정했습니다!

참고 자료에서 AppStore에 state 있는데 ViewState 존재 이유를 몰랐었는데
리덕스는 새로운 state값을 만들어서 바꿔 return 할때 불변성 개념을 적용하고자 작성했었던 것 알게되었고
새로운 상태를 init로 생성해 주며 전달하기 까지 리덕스 개념과 흐름을 공부하는데 많이 도움이 되었습니다.

구조를 그려보면 이렇습니다!
스크린샷 2021-07-26 오후 8 39 54

Copy link

@GangWoon GangWoon left a comment

Choose a reason for hiding this comment

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

Screen Shot 2021-08-01 at 19 35 20

그림과 동일하게 작성하실 필요는 없습니다.

Reducer를 공부하실 때 Effect에 대해서 찾아보셨나요?
비동기적인 처리를 할 때 Redux패턴의 강점을 경험할 수 있다고 생각합니다.

appCoordinator = AppCoordinator(navigation: navigationController,
dependency: .init(loginCoordinatorFactory: appDependency.makeLoginCoordinator,
tabBarCoordinatorFactory: appDependency.makeTabBarCoordinator))

appCoordinator?.dispatch = appStore.dispatch(_:)
appStore.updateState = appCoordinator?.update(with:)
appCoordinator?.loadInitalView()
Copy link

Choose a reason for hiding this comment

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

결과의 차이는 없겠지만, 엑션을 방출하는 건 외부에서 호출하는게 아닌 자기 자신이 해야할 의무같습니다.

Copy link
Author

Choose a reason for hiding this comment

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

이것또한 바꿔 보도록 하겠습니다


func update(with state: TokenState) {
switch state.token {
case .empty:
Copy link

Choose a reason for hiding this comment

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

비동기적인 콜백함수를 처리하는 방식에 대해서 공부하셨으면 좋겠습니다.

Copy link
Author

@HoonHaChoi HoonHaChoi Aug 2, 2021

Choose a reason for hiding this comment

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

넵 switch 문이 아닌 비동기 콜백으로 고쳐보도록하겠습니다

강운 혹시 이 부분에 대해 문제점이 무엇인가요??

@HoonHaChoi
Copy link
Author

Effect는 처음보는거 같은데 찾아봐야겠네요

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

Successfully merging this pull request may close these issues.

3 participants