FLEXVariableEditorViewController.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. /// Subclasses can change the button title via the button's \c title property
  35. @property (nonatomic, readonly) UIBarButtonItem *actionButton;
  36. /// Subclasses should override to provide "set" functionality.
  37. /// The commit handler--if present--is called here.
  38. - (void)actionButtonPressed:(nullable id)sender;
  39. /// Pushes an explorer view controller for the given object
  40. /// or pops the current view controller.
  41. - (void)exploreObjectOrPopViewController:(nullable id)objectOrNil;
  42. @end
  43. NS_ASSUME_NONNULL_END