FLEXRuntime+UIKitHelpers.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // FLEXRuntime+UIKitHelpers.h
  3. // FLEX
  4. //
  5. // Created by Tanner Bennett on 12/16/19.
  6. // Copyright © 2019 Flipboard. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "FLEXProperty.h"
  10. #import "FLEXIvar.h"
  11. #import "FLEXMethod.h"
  12. @protocol FLEXRuntimeMetadata <NSObject>
  13. /// YES for properties and ivars which surely support editing, NO for all methods.
  14. @property (nonatomic, readonly) BOOL isEditable;
  15. /// NO for ivars, YES for supported methods and properties
  16. @property (nonatomic, readonly) BOOL isCallable;
  17. /// For internal use
  18. @property (nonatomic) id tag;
  19. /// Should return \c nil if not applicable
  20. - (id)currentValueWithTarget:(id)object;
  21. /// Used as the subtitle or description of a property, ivar, or method
  22. - (NSString *)previewWithTarget:(id)object;
  23. /// For methods, a method calling screen. For all else, an object explorer.
  24. - (UIViewController *)viewerWithTarget:(id)object;
  25. /// For methods, nil. For all else, an a field editor screen.
  26. - (UIViewController *)editorWithTarget:(id)object;
  27. /// Used to determine present which interactions are possible to the user
  28. - (UITableViewCellAccessoryType)suggestedAccessoryTypeWithTarget:(id)object;
  29. @end
  30. // Even if a property is readonly, it still may be editable
  31. // via a setter. Checking isEditable will not reflect that
  32. // unless the property was initialized with a class.
  33. @interface FLEXProperty (UIKitHelpers) <FLEXRuntimeMetadata> @end
  34. @interface FLEXIvar (UIKitHelpers) <FLEXRuntimeMetadata> @end
  35. @interface FLEXMethodBase (UIKitHelpers) <FLEXRuntimeMetadata> @end
  36. @interface FLEXMethod (UIKitHelpers) <FLEXRuntimeMetadata> @end