Ribs Tutorial 1 뭘까 ?

조영민·2022년 6월 21일
0

출처: https://github.com/uber/RIBs/wiki/iOS-Tutorial-1

번역 및 생각 정리
RIBs 어렵다.

The boilerplate code that we provide contains an iOS project that consists of two RIBs. When the app launches, its AppDelegate builds a Root RIB and transfers control over the application to it. The purposes of the Root RIB are to serve as a root of the RIBs tree and to transfer control to its children when necessary. The Root RIB's code is mostly autogenerated by Xcode templates, understanding this code is not required for this exercise.

RIBs 2개가 만들어진다. Appdelegate가 만드는 Root Ribs는 어플리케이션 전체의 립스
굳이 이해할 필요는 없다. XCode 템플릿이 만들어준다.

The second RIB in TicTacToe app is called LoggedOut, it should contain the login interface and manage authentication-related events. When the Root RIB gains control over the app from the AppDelegate, it immediately transfers it to the LoggedOut RIB to display the login form. The code responsible for building and presenting LoggedOut RIB is already provided and can be found in RootRouter.

TicTacToe 앱의 2번째 립스는 'LoggedOut'이다 로그인 인터페이스와 권한 관련 이벤트를 관리한다. Root 립이 권한을 얻으면, 즉시 전달한다 LoggedOut 립으로 로그인 화면이 보이게.
LoggedOut 립이 만들어지고 보여지는건 RootRouter에 적혀있다.

-> 전 화면에서 다음 화면으로 가게 해주는 친구가 Router 인가 ?

그림을 보면 Router가 Interactor에게 다른 립스의 값을 할당하라라고 적혀있다.
Interactor는 비지니스로직을 담고 있고 Router에게 다른 RIBs를 Route하라고 시킨다.
Interactor는 View에게 Model을 주고 View는 Interactor에게 UserInput에 맞게 비지니스 로직을 하라고 적혀있다.

Builder는 Buildable을 채택한다. Mock으로 만들어 테스트가 가능하다.

Router는 ~~Routing 프로토콜을 따르고 이것과 소통한다.
POP니까 의존성 역전에 해당한다.
Presentable역시 같은 로직으로 Interactor가 View와 소통한다.

정리 ->
1. Interactor Router -> ~~~Routing 프로토콜
2. Builder -> Buildable
3. Interactor View -> Presentable
4. View Interactor -> PresentableListener 프로토콜
5. Router View -> ViewControllerable 프로토콜

아하 립스는 각 2개씩 정도의 프로토콜로 각자 소통을 하는구나 !

View에서 로그인버튼을 눌렀을때 비어있으면 X
그렇다면 이건? 비지니스 로직. 어디에 있어야할까? Interactor
POP니까 View가 Interator와 소통 어디서 해 ? Protocol
위에 보면 4번에 View가 알고있는 Interator protocol누구야 ?
PresentableListenr , 아하 그럼 거기에 코드 작성해주면 되겠다.

틀렸을수도 있다. 당장은 이해가 잘된거같다. 오 !

끝.

0개의 댓글