简体   繁体   中英

UIViewController transitions using MVVM+Coordinators pattern

I am creating my first app with mvvm+coordinator pattern and I faced some interesting architectural problems. How could you implement custom view controller transitions with this pattern? The basic app structure is the usual list of items (each with a foto) + details view for each item. The animated view controller transitions are quite fashionable right now, ie tapping on the foto in the list animates the foto to the final position on the details view. Now, to implement this the transition has to know both the original and the final rect of the image. But the transition otherwise implemented only on the ViewModel level by the Coordinator. How can such particularity like the coordinates of the image inserted into the ViewModel transition event?

You are right, the coordinates are not allowed to appear in viewmodel, but they abstraction. So in viewmodel you can put your abstraction and in view a converter to resolve this abstraction.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM