LOTKeypath.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // LOTKeypath.h
  3. // Lottie_iOS
  4. //
  5. // Created by brandon_withrow on 12/13/17.
  6. // Copyright © 2017 Airbnb. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. extern NSString * _Nonnull const kLOTKeypathEnd;
  10. /*!
  11. @brief LOTKeypath is an object that describes a keypath search for nodes in the animation JSON. LOTKeypath matches views inside of LOTAnimationView to their After Effects counterparts.
  12. @discussion
  13. LOTKeypath is used with LOTAnimationView to set animation properties dynamically at runtime, to add or mask subviews, converting geometry, and numerous other functions.
  14. LOTKeypath can describe a specific object, or can use wildcards for fuzzy matching of objects. Acceptable wildcards are either "*" (star) or "**" (double star). Single star will search a single depth for the next object, double star will search any depth.
  15. Read More at http://airbnb.io/lottie/ios/dynamic.html
  16. EG:
  17. @"Layer.Shape Group.Stroke 1.Color"
  18. Represents a specific color node on a specific stroke.
  19. @"**.Stroke 1.Color"
  20. Represents the color node for every "Stroke 1" in the animation scene.
  21. */
  22. @interface LOTKeypath : NSObject
  23. /*!
  24. @brief Creates a LOTKeypath from a dot separated string, can use wildcards @"*" and fuzzy depth wild cards @"**".
  25. @discussion LOTKeypath is an object that describes a keypath search for nodes in the animation JSON.
  26. LOTKeypath is used with LOTAnimationView to set animation properties dynamically at runtime, to add or mask subviews, converting geometry, and numerous other functions.
  27. LOTKeypath can describe a specific object, or can use wildcards for fuzzy matching of objects. Acceptable wildcards are either "*" (star) or "**" (double star). Single star will search a single depth for the next object, double star will search any depth.
  28. @param keypath A dot separated string describing a keypath from the JSON animation. EG @"Layer.Shape Group.Stroke 1.Color"
  29. @return A new LOTKeypath
  30. */
  31. + (nonnull LOTKeypath *)keypathWithString:(nonnull NSString *)keypath;
  32. /*!
  33. @brief Creates a LOTKeypath from a list of keypath string objects, can use wildcards @"*" and fuzzy depth wild cards @"**".
  34. @discussion LOTKeypath is an object that describes a keypath search for nodes in the animation JSON.
  35. LOTKeypath is used with LOTAnimationView to set animation properties dynamically at runtime, to add or mask subviews, converting geometry, and numerous other functions.
  36. LOTKeypath can describe a specific object, or can use wildcards for fuzzy matching of objects. Acceptable wildcards are either "*" (star) or "**" (double star). Single star will search a single depth for the next object, double star will search any depth.
  37. @param firstKey A nil terminated list of strings describing a keypath. EG @"Layer", @"Shape Group", @"Stroke 1", @"Color", nil
  38. @return A new LOTKeypath
  39. */
  40. + (nonnull LOTKeypath *)keypathWithKeys:(nonnull NSString *)firstKey, ...
  41. NS_REQUIRES_NIL_TERMINATION;
  42. @property (nonatomic, readonly, nonnull) NSString *absoluteKeypath;
  43. @property (nonatomic, readonly, nonnull) NSString *currentKey;
  44. @property (nonatomic, readonly, nonnull) NSString *currentKeyPath;
  45. @property (nonatomic, readonly, nonnull) NSDictionary *searchResults;
  46. @property (nonatomic, readonly) BOOL hasFuzzyWildcard;
  47. @property (nonatomic, readonly) BOOL hasWildcard;
  48. @property (nonatomic, readonly) BOOL endOfKeypath;
  49. - (BOOL)pushKey:(nonnull NSString *)key;
  50. - (void)popKey;
  51. - (void)popToRootKey;
  52. - (void)addSearchResultForCurrentPath:(id _Nonnull)result;
  53. @end