tbointeractive / TBODeveloperOverlay

A collection of developer tools for debugging iOS Apps
MIT License
5 stars 2 forks source link

Make the TBODeveloperOverlayKVDebugger better extendable #3

Open brototyp opened 8 years ago

brototyp commented 8 years ago

I think it would be great to have a way to set custom ViewController for custom classes in the KVDebugger. This way, one could add custom (possibly complex) objects to it and be able to not only see the -description of it but inspect and edit in a way specific to this class.

This could work by add a mapping between the Class names of the Objects and Class names of the responsible ViewController

bernhard-eiling commented 8 years ago

The proposal:

We configure the TBODeveloperOverlayKVDebugger with an array of TBODeveloperOverlayKVDebuggerItem.

@interface TBODeveloperOverlayKVDebuggerItem : NSObject

- (instancetype)initWithType:(id)type detailViewControllerClass:(Class)detailViewControllerClass andEditingBlock:(void (^)(id))editingBlock;

@end

On row select in TBODeveloperOverlayKVDebugger we initialize a DetailViewController conforming to the following protocol.

@protocol

- (instancetype)initWithValue:(id)value andEditingBlock:(void (^)(id))editingBlock;

@end

We check for the type at the selected indexPath and initialize a DetailViewController for the specified type.

All DetailViewControllers are inheritating from a TBODeveloperOverlayKVDebuggerBaseDetailViewController. This ViewControllers is responsible for sharing certain items via UIActivity​View​Controller, for that matter all Subclasses need to implement

- (NSArray *)sharableItems;

to return the desired items.

When editing the values in the DetailViewControllers their editingBlock gets called with the updated values on which TBODeveloperOverlayKVDebugger can update it's Datasource.

bernhard-eiling commented 8 years ago

@brototyp @thorstenstark What are your ideas to the proposal?