Skip to content
Angel Cortez edited this page May 9, 2020 · 4 revisions

RIBs, Needles, and Plugins

RIBs is Uber's cross-platform architecture framework. Needle is a dependency injection (DI) framework for Swift. The purpose of this project is show how these to frameworks and the concept of Plugins can come together to make cohesive and robust app architecture.

Hierarchy

This project's hierarchy and structure differs slightly from the RIB's example project, Tic Tac Toe, in that this project includes a Configuration, Logged In Plugin Point, and ScoreSheet components.

RIBs

Configuration

Configuration is a component, where app configuration code is retreived for app use. This configuration code may hold important metadata and state information of the app and it's plugins. For example, in this project we load metadata necessay for the UI of the ScoreSheet plugin, such as the displayName and enabled (which is enables or disables the ScoreSheet plugin).

The configuration object is passed to the different components is a simple Dictionary[String:Any], so that we don't leak implementation details to the child RIBlets consuming the configuration dictionary. As recommended by Robert C. Martin in Clean Architecture: A Craftman's Guide to Software Strucuture and Design

PLEASE NOTE: In this project, the app does not launch into main flow without receiving configuration code; however this is anti-pattern for retrieving remote configuration code. Please refer to the following blog post, in which the Firebase team provides guidelines on retrieving and loading remote configuration.

Logged In Plugin Point

Logged In Plugin Point is a component, where Logged In plugins integrate. However, unlike at Uber (Enforcing isolation between parent RIBs and children), we haven't used custom build tooling to ensure parent RIBs cannot refer to child RIB. In this project, we enforce separation of concerns using a separate modules. One module for the integration point LoggedInPluginPoint, and another for the which contains the Plugin protocol abstraction, LoggedInPlugin. Finally, integrating in the Logged In component.

Score Sheet

Score Sheet is a plugin component. This component is essentially an alternate scoreboard from the original one provided in the OffGame component. This plugin component integrates into the LoggedInPluginPoint, and configured base on the configuration code (Dictionary[String:Any]) provided by the Configuration component.

Clone this wiki locally