Architecture (swift)/RIBs
[iOS - swift] 4-6) RIBs 튜토리얼 (Deeplinking, Workflows, Actionable item)
jake-kim
2021. 4. 26. 22:32
원리
- LaunchGameWorkflow에서 Rx로 진행 로직 구현
- 각 Interactor는 -ActionableItem 프로토콜을 구현
- RootActionableItem: 로그인을 기다리다가 끝날 경우 로직 수행
- LoggedInActionableItem: 바로 game을 시작하도록 로직 수행

url 스킴 등록
- URL: ribs-training://launchGame?gameId=ticTacToe
- info.plist에 등록
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.uber.TicTacToe</string>
<key>CFBundleURLSchemes</key>
<array>
<string>ribs-training</string>
</array>
</dict>
</array>

UrlHandler
- AppDelegate에 프로토콜 선언 -> RootInteractor에서 프로토콜 구현 -> RootBuilder에서 build()함수의 리턴값에 urlHandler 추가
-> AppDelegate에서 urlHandler객체를 얻어지면 등록 -> AppDelegate에서 url 메시지가 오면 handle(url)호출
Workflows, ActionableItem 개념
- workflows: RIB트리에서 operation progress를 통하여 트리를 up and down 할 수 있는 것
- workflow에서 트리를 up and down: 현재 스텝이 끝나면 .onStep으로 다음 스텝 실행
- ActionableItem의 리턴값: (NextActionableItem, NextValueType)

Workflows, ActionableItem 동작 방식
- 각 Interactor에 ActionableItem 프로토콜을 구현
