RIBs
RIBs copied to clipboard
Plugin framework?
Thanks to the Uber team for open-sourced Ribs, but I haven't found anything about the Plugin framework you mentioned in many places. Yes, here plugins is a very conceptual introduction and a Youtube share. Is there any more substantial content? For example, a Plugin Point Demo???
@Alvazz I second this @tyvsmith there is a swift example here https://github.com/Angel-Cortez/example-buck-ribs-needle
The plugin framework we're using is not open-source. It has deep ties into the (custom) feature flagging system used at Uber, hence it's hard to open source. For now, the conceptual ideas are all that's available.
Our framework has two key classes, a PluginPoint and a PluginFactory. The factory is simply a wrapper around some other class. It also has an isApplicable method that allows custom logic to decide if the this particular plugin is usable at this time. The base class for the factory ensures that a feature flag must be passed in, in order to create a factory.
The plugin point holds an array of these factories. There are different types, but the simplest one is where the plugin point goes down the array and asks each point if it's applicable or not. The first one to answer yes is then asked to create and return an instance of the object. The plugin point as a createPlugin function that the consumer calls.
Typically the objects returned by the plugin point conform to a protocol so that we can have a variety, of buttons for example, and still have just a fixed return type.