Open dangthaison91 opened 4 years ago
I think this should be implemented via Observable
, not individual delegate methods. Also, I wouldn't allow to pass Routing
object reference around, I would limit it to a String
:
String(describing: type(of: router))
or perhaps a struct
type implementing a protocol:
public protocol RIBInfo {
var name: String { get }
var childrenCount: Int { get }
var isActive: Bool { get }
}
We are trying to improve the overall performance of our app. The first thing we think we should do beside of manual Profiling is tracking performance for specific code.
For UIView/UIViewController, swizzle help to automatically record a trace then send to a Telemetry tracing API. We also want to do that for Interactor/Router but they are pure Swift so no swizzle at all.
We tried to do that by adding more lifecycle events for Router and Interactor like below:
Router:
Then we can do recursive observe for child RIBs lifecycle to add performance trace. This enables as we can add observer only one in Root:
RootRouter:
We can simply add observer at the Root RIB and for example, use os_signpost to tracing performance in Instrument:
Adding more lifecycle event for Router also help to easier to implement a RIB Tree real-time viewer like https://github.com/srea/RIBsTreeViewerClient or https://github.com/imairi/RIBsTreeMaker
I really want to know your ideas and willing to open a PR if this will make sense to include in Uber RIBs