-
Notifications
You must be signed in to change notification settings - Fork 0
MVI 구조 적용 #12
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: concurrency
Are you sure you want to change the base?
MVI 구조 적용 #12
Conversation
hooni0918
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.
LGTM
|
|
||
| import Foundation | ||
|
|
||
| // 아마 selectedTab 정도는 여기서 관리할 수 있을 듯 |
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.
👍
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.
다시보니 TabView의 selection 매개변수도 binding 값을 전달해주어야해서 navigation에서는 intent 정도만 사용할 수 있을 것 같우네요~~~~ㅜ
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.
하나를 알려주면 MVI를 통으로 이해하는 주리 미쳣다
| func dispatch(_ intent: NavigationIntent) { | ||
| switch intent { | ||
| case .push(let view): | ||
| path.append(view) | ||
| case .pop(let depth): | ||
| path.removeLast(depth) | ||
| } |
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.
LGTM👍
|
|
||
| import Foundation | ||
|
|
||
| // viewModel에서 published로 선언하는 변수 느낌이라고 이해함 |
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.
정확합니다. 정확하게는 구조체로 선언해서 한군데에서 관리하기에 UI의 가능한 모든 상태를 명확하게 표현하는 타입이라고 이해하시면 되는데 한군데서 모아둿다 생각해도 되긴함미다
| var error: String? = nil | ||
| } | ||
|
|
||
| // 사용자가 할 수 있는 행동의 모든 경우의 수 (action) |
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.
Yes!
| // 변수 부분을 state로 관리하고 | ||
| // 함수 부분을 intent로 관리하는 느낌이랄까 ? ? ? | ||
| @MainActor |
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.
정확합니다.
이미 구조체로 선언을 다 해줫기때문에 모든 로직이 예측 가능해지는 장점이 있는거죠
저도 코드를 작성할때는 이유를 잘 몰랏었는데 말그대로 부수 효과들을 직접 처리하지 않고 한번더 이펙트로 빼서 사용하면 됩니다
등이 예시가 될 수 있겟죠!
이렇게 해도 좋지만 위에서 말한것과 같이 "정확하게 의도를 드러내야하기 때문에" 한번에 하나씩만 언급했습니다. actor 맞습니다. 하지만 현재는 복잡한 UI를 그리는 내용도 없고 (메인 쓰레드에 다 떄려박아도 성능저하는 없는정도,,) 여러개의 api를 0.5초단위로 불러온다던지 등의 작업은 없기때문에 현재단계에서는 actor를 굳이 안쓰셔도 됩니다 합숙끝나고 actor 관련해서 한번더 미미나 해드릴게요 네비게이션에 MVI 적용 시도 완벽한 이해입니다 진짜 멋져!! |

이해한 MVI에 대해...
State -> Model
Intent
Store
-> 사실 조금 더 분리된 MVVM이라고 느껴짐 .......
궁금한 점
actor
네비게이션에 MVI 적용 시도