FLEXObjectExplorerViewController.h 2.8 KB

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