I'm working on an iOS MVVM + Coordinator/ RxSwift project (non swiftUI).
In the groundViewController, there are multiple items on the screen, and the user can tap on any item to call a detailed view of that item. The detailed view will slide in after tapping on an item, and when the user taps another item, the detailed view will sliding out then sliding in again with updated info. detailedView is half screen size, user can also tap on empty space on groundViewController to dismiss the detailed view (sliding out animation).(So there will be only one detailedView)
I decided to make that detailed view as an UIView, which will have its own coordinator and ViewModel and be added to groundViewControll.view. But I'm now confused about how to communicate between them or event flow.
Question: In MVVM/Coordinator pattern, is it correct to make this flow as:
groundViewController (receive a tap on the object) - >
groundViewModel - >
groundCoordinator (creat and pass itemID ) - >
detailedViewCoordinator (creat) - >
detailedViewModel and detialedView
And who should in charge of detialedView's sliding in/out animation?
When the ground view receives the tap, it tells the ground view model.
There are some variations in exactly when items are created and destroyed, but the above is the general idea.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.