FLEXShortcut.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // FLEXShortcut.h
  3. // FLEX
  4. //
  5. // Created by Tanner Bennett on 12/10/19.
  6. // Copyright © 2019 Flipboard. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. /// Represents a row in a shortcut section.
  10. ///
  11. /// The purpsoe of this protocol is to allow delegating a small
  12. /// subset of the responsibilities of a \c FLEXShortcutsSection
  13. /// to another object, for a single arbitrary row.
  14. ///
  15. /// It is useful to make your own shortcuts to append/prepend
  16. /// them to the existing list of shortcuts for a class.
  17. @protocol FLEXShortcut <NSObject>
  18. - (NSString *)titleWith:(id)object;
  19. - (NSString *)subtitleWith:(id)object;
  20. //- (void (^)(UIViewController *))didSelectAction:(id)object;
  21. /// Called when the row is selected
  22. - (UIViewController *)viewerWith:(id)object;
  23. /// Basically, whether or not to show a detail disclosure indicator
  24. - (UITableViewCellAccessoryType)accessoryTypeWith:(id)object;
  25. @optional
  26. /// Called when the (i) button is pressed
  27. - (UIViewController *)editorWith:(id)object;
  28. @end
  29. /// Provides default behavior for FLEX metadata objects.
  30. @interface FLEXShortcut : NSObject <FLEXShortcut>
  31. /// @param item An \c NSString or \c FLEX* metadata object.
  32. /// @note You may also pass a \c FLEXShortcut conforming object,
  33. /// and that object will be returned instead.
  34. + (id<FLEXShortcut>)shortcutFor:(id)item;
  35. @end