-
Architecture Pattern-MVVMAndroid 2020. 9. 2. 18:36반응형
MVVM
Model , View , ViewModel의 약자입니다.
ViewModel은 데이터와 명령을 구현하고 상태가 변경되면 View에 알려 줍니다.
상태 변경 알림을 받은 View는 변경을 적용할지 말지를 결정합니다.
View는 VM을 알지만 Model을 모르고 VM은 Model은 알지만 View를 모릅니다.
View와 VM는 N : 1 관계이기 때문에 VM의 재사용이 가능하지만
코드의 가독성이 떨어지고 복잡해질 수 있기 때문에 1:1 로 많이 사용하는 편입니다.
Data Bind, RxJava, LifeCycler등을 주로 같이 사용합니다.
AAC ViewModel
화면 회전시 데이터 유지를 위하여 만들었습니다.
안드로이드의 생명주기를 알고 있기 때문에 화면 회전시 데이터 유지를 할 수 있습니다.
반응형'Android' 카테고리의 다른 글
Fragment lifecycle (0) 2020.09.02 Activity lifecycle (0) 2020.09.02 Architecture Pattern-MVP (0) 2020.09.02 Architecture Pattern-MVC (0) 2020.09.02 Alarm Manager (0) 2020.09.02