FLEXRuntime+UIKitHelpers.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. #import "FLEXProtocol.h"
  13. @protocol FLEXRuntimeMetadata <NSObject>
  14. @property (nonatomic, readonly) NSString *name;
  15. /// YES for properties and ivars which surely support editing, NO for all methods.
  16. @property (nonatomic, readonly) BOOL isEditable;
  17. /// NO for ivars, YES for supported methods and properties
  18. @property (nonatomic, readonly) BOOL isCallable;
  19. /// For internal use
  20. @property (nonatomic) id tag;
  21. /// Should return \c nil if not applicable
  22. - (id)currentValueWithTarget:(id)object;
  23. /// Used as the subtitle or description of a property, ivar, or method
  24. - (NSString *)previewWithTarget:(id)object;
  25. /// For methods, a method calling screen. For all else, an object explorer.
  26. - (UIViewController *)viewerWithTarget:(id)object;
  27. /// For methods and protocols, nil. For all else, an a field editor screen.
  28. - (UIViewController *)editorWithTarget:(id)object;
  29. /// Used to determine present which interactions are possible to the user
  30. - (UITableViewCellAccessoryType)suggestedAccessoryTypeWithTarget:(id)object;
  31. @end
  32. // Even if a property is readonly, it still may be editable
  33. // via a setter. Checking isEditable will not reflect that
  34. // unless the property was initialized with a class.
  35. @interface FLEXProperty (UIKitHelpers) <FLEXRuntimeMetadata> @end
  36. @interface FLEXIvar (UIKitHelpers) <FLEXRuntimeMetadata> @end
  37. @interface FLEXMethodBase (UIKitHelpers) <FLEXRuntimeMetadata> @end
  38. @interface FLEXMethod (UIKitHelpers) <FLEXRuntimeMetadata> @end
  39. @interface FLEXProtocol (UIKitHelpers) <FLEXRuntimeMetadata> @end