FLEXRuntimeUtility.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // FLEXRuntimeUtility.h
  3. // Flipboard
  4. //
  5. // Created by Ryan Olson on 6/8/14.
  6. // Copyright (c) 2014 Flipboard. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <objc/runtime.h>
  10. extern const unsigned int kFLEXNumberOfImplicitArgs;
  11. @interface FLEXRuntimeUtility : NSObject
  12. // Property Helpers
  13. + (NSString *)prettyNameForProperty:(objc_property_t)property;
  14. + (NSString *)typeEncodingForProperty:(objc_property_t)property;
  15. + (BOOL)isReadonlyProperty:(objc_property_t)property;
  16. + (SEL)setterSelectorForProperty:(objc_property_t)property;
  17. + (NSString *)fullDescriptionForProperty:(objc_property_t)property;
  18. + (id)valueForProperty:(objc_property_t)property onObject:(id)object;
  19. + (NSString *)descriptionForIvarOrPropertyValue:(id)value;
  20. + (void)addFramePropertyToUIViewIfNeeded;
  21. // Ivar Helpers
  22. + (NSString *)prettyNameForIvar:(Ivar)ivar;
  23. + (id)valueForIvar:(Ivar)ivar onObject:(id)object;
  24. + (void)setValue:(id)value forIvar:(Ivar)ivar onObject:(id)object;
  25. // Method Helpers
  26. + (NSString *)prettyNameForMethod:(Method)method isClassMethod:(BOOL)isClassMethod;
  27. + (NSArray *)prettyArgumentComponentsForMethod:(Method)method;
  28. // Method Calling/Field Editing
  29. + (id)performSelector:(SEL)selector onObject:(id)object withArguments:(NSArray *)arguments error:(NSError * __autoreleasing *)error;
  30. + (NSString *)editableJSONStringForObject:(id)object;
  31. + (id)objectValueFromEditableJSONString:(NSString *)string;
  32. + (NSValue *)valueForNumberWithObjCType:(const char *)typeEncoding fromInputString:(NSString *)inputString;
  33. + (void)enumerateTypesInStructEncoding:(const char *)structEncoding usingBlock:(void (^)(NSString *structName, const char *fieldTypeEncoding, NSString *prettyTypeEncoding, NSUInteger fieldIndex, NSUInteger fieldOffset))typeBlock;
  34. + (NSValue *)valueForPrimitivePointer:(void *)pointer objCType:(const char *)type;
  35. @end