FLEXVariableEditorViewController.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // FLEXVariableEditorViewController.h
  3. // Flipboard
  4. //
  5. // Created by Ryan Olson on 5/16/14.
  6. // Copyright (c) 2020 FLEX Team. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. @class FLEXFieldEditorView;
  10. @class FLEXArgumentInputView;
  11. NS_ASSUME_NONNULL_BEGIN
  12. /// An abstract screen for editing or configuring one or more variables.
  13. /// "Target" is the target of the edit operation, and "data" is the data
  14. /// you want to mutate or pass to the target when the action is performed.
  15. /// The action may be something like calling a method, setting an ivar, etc.
  16. @interface FLEXVariableEditorViewController : UIViewController {
  17. @protected
  18. id _target;
  19. _Nullable id _data;
  20. void (^_Nullable _commitHandler)();
  21. }
  22. /// @param target The target of the operation
  23. /// @param data The data associated with the operation
  24. /// @param onCommit An action to perform when the data changes
  25. + (instancetype)target:(id)target data:(nullable id)data commitHandler:(void(^_Nullable)())onCommit;
  26. /// @param target The target of the operation
  27. /// @param data The data associated with the operation
  28. /// @param onCommit An action to perform when the data changes
  29. - (id)initWithTarget:(id)target data:(nullable id)data commitHandler:(void(^_Nullable)())onCommit;
  30. @property (nonatomic, readonly) id target;
  31. /// Convenience accessor since many subclasses only use one input view
  32. @property (nonatomic, readonly, nullable) FLEXArgumentInputView *firstInputView;
  33. @property (nonatomic, readonly) FLEXFieldEditorView *fieldEditorView;
  34. #if TARGET_OS_TV
  35. /// Subclasses can change the button title via the button's \c title property
  36. @property (nonatomic, readonly) UIButton *actionButton;
  37. #else
  38. /// Subclasses can change the button title via the button's \c title property
  39. @property (nonatomic, readonly) UIBarButtonItem *actionButton;
  40. #endif
  41. /// Subclasses should override to provide "set" functionality.
  42. /// The commit handler--if present--is called here.
  43. - (void)actionButtonPressed:(nullable id)sender;
  44. /// Pushes an explorer view controller for the given object
  45. /// or pops the current view controller.
  46. - (void)exploreObjectOrPopViewController:(nullable id)objectOrNil;
  47. @end
  48. NS_ASSUME_NONNULL_END