FLEXObjectExplorerViewController.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //
  2. // FLEXObjectExplorerViewController.h
  3. // Flipboard
  4. //
  5. // Created by Ryan Olson on 2014-05-03.
  6. // Copyright (c) 2014 Flipboard. All rights reserved.
  7. //
  8. #ifndef _FLEXObjectExplorerViewController_h
  9. #define _FLEXObjectExplorerViewController_h
  10. #endif
  11. #import "FLEXTableViewController.h"
  12. typedef NS_ENUM(NSUInteger, FLEXObjectExplorerSection) {
  13. FLEXObjectExplorerSectionDescription,
  14. FLEXObjectExplorerSectionCustom,
  15. FLEXObjectExplorerSectionProperties,
  16. FLEXObjectExplorerSectionIvars,
  17. FLEXObjectExplorerSectionMethods,
  18. FLEXObjectExplorerSectionClassMethods,
  19. FLEXObjectExplorerSectionSuperclasses,
  20. FLEXObjectExplorerSectionReferencingInstances
  21. };
  22. @interface FLEXObjectExplorerViewController : FLEXTableViewController
  23. @property (nonatomic) id object;
  24. // Subclasses can override the methods below to provide data in a custom section.
  25. // The subclass should provide an array of "row cookies" to allow retrieval of individual row data later on.
  26. // The objects in the rowCookies array will be used to call the row title, subtitle, etc methods to construct the rows.
  27. // The cookies approach is used here because we may filter the visible rows based on the search text entered by the user.
  28. - (NSString *)customSectionTitle;
  29. - (NSArray *)customSectionRowCookies;
  30. - (NSString *)customSectionTitleForRowCookie:(id)rowCookie;
  31. - (NSString *)customSectionSubtitleForRowCookie:(id)rowCookie;
  32. - (BOOL)customSectionCanDrillIntoRowWithCookie:(id)rowCookie;
  33. - (UIViewController *)customSectionDrillInViewControllerForRowCookie:(id)rowCookie;
  34. - (UIView *)customViewForRowCookie:(id)rowCookie;
  35. // More subclass configuration hooks.
  36. /// Whether to allow showing/drilling in to current values for ivars and properties. Default is YES.
  37. - (BOOL)canHaveInstanceState;
  38. /// Whether to allow drilling in to method calling interfaces for instance methods. Default is YES.
  39. - (BOOL)canCallInstanceMethods;
  40. /// If the custom section data makes the description redundant, subclasses can choose to hide it. Default is YES.
  41. - (BOOL)shouldShowDescription;
  42. /// Subclasses can reorder/change which sections can display directly by overriding this method.
  43. - (NSArray *)possibleExplorerSections;
  44. /// Subclasses can override to provide a more useful description
  45. - (NSString *)displayedObjectDescription;
  46. @end
  47. @interface FLEXObjectExplorerViewController (Shortcuts)
  48. /// @brief Names of properties to supply as shortcuts. If this array is empty, no shortcuts are displayed.
  49. ///
  50. /// @discussion Populating this array in a subclass will make FLEXObjectExplorerViewController show a custom
  51. /// section with row titles like "@property NSString *foo" and subtitles with their values.
  52. /// customSectionRowCookies will return this array. Every row in the section is drillable by default.
  53. ///
  54. /// For an example on how to use the default behavior provided or to override it,
  55. /// see FLEXViewExplorerViewController
  56. - (NSArray<NSString *> *)shortcutPropertyNames;
  57. @end