LOTAnimatedSwitch.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // LOTAnimatedSwitch.h
  3. // Lottie
  4. //
  5. // Created by brandon_withrow on 8/25/17.
  6. // Copyright © 2017 Airbnb. All rights reserved.
  7. //
  8. #import "LOTAnimatedControl.h"
  9. NS_ASSUME_NONNULL_BEGIN
  10. @interface LOTAnimatedSwitch : LOTAnimatedControl
  11. /// Convenience method to initialize a control from the Main Bundle by name
  12. + (instancetype _Nonnull)switchNamed:(NSString * _Nonnull)toggleName;
  13. /// Convenience method to initialize a control from the specified bundle by name
  14. + (instancetype _Nonnull)switchNamed:(NSString * _Nonnull)toggleName inBundle:(NSBundle * _Nonnull)bundle;
  15. /// The ON/OFF state of the control. Setting will toggle without animation
  16. @property (nonatomic, getter=isOn) BOOL on;
  17. /// Enable interactive sliding gesture for toggle
  18. @property (nonatomic) BOOL interactiveGesture;
  19. /// Set the state of the control with animation
  20. - (void)setOn:(BOOL)on animated:(BOOL)animated; // does not send action
  21. /// Styling
  22. /**
  23. * Sets the animation play range for the ON state animation.
  24. * fromProgress is the start of the animation
  25. * toProgress is the end of the animation and also the ON static state
  26. * Defaults 0-1
  27. **/
  28. - (void)setProgressRangeForOnState:(CGFloat)fromProgress
  29. toProgress:(CGFloat)toProgress NS_SWIFT_NAME(setProgressRangeForOnState(fromProgress:toProgress:));
  30. /**
  31. * Sets the animation play range for the OFF state animation.
  32. * fromProgress is the start of the animation
  33. * toProgress is the end of the animation and also the OFF static state
  34. * Defaults 1-0
  35. **/
  36. - (void)setProgressRangeForOffState:(CGFloat)fromProgress
  37. toProgress:(CGFloat)toProgress NS_SWIFT_NAME(setProgressRangeForOffState(fromProgress:toProgress:));
  38. @end
  39. NS_ASSUME_NONNULL_END