AnimatableTabBarItem.swift 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // Created by Eric Marchand on 23/02/2018.
  3. // Copyright © 2018 IBAnimatable. All rights reserved.
  4. //
  5. import UIKit
  6. @IBDesignable
  7. open class AnimatableTabBarItem: UITabBarItem, Animatable {
  8. // MARK: - Animatable
  9. open var animationType: AnimationType = .none
  10. @IBInspectable var _animationType: String? {
  11. didSet {
  12. animationType = AnimationType(string: _animationType)
  13. }
  14. }
  15. @IBInspectable open var autoRun: Bool = true
  16. @IBInspectable open var duration: Double = Double.nan
  17. @IBInspectable open var delay: Double = Double.nan
  18. @IBInspectable open var damping: CGFloat = CGFloat.nan
  19. @IBInspectable open var velocity: CGFloat = CGFloat.nan
  20. @IBInspectable open var force: CGFloat = CGFloat.nan
  21. @IBInspectable var _timingFunction: String = "" {
  22. didSet {
  23. timingFunction = TimingFunctionType(string: _timingFunction)
  24. }
  25. }
  26. open var timingFunction: TimingFunctionType = .none
  27. // MARK: - Lifecycle
  28. open override func prepareForInterfaceBuilder() {
  29. super.prepareForInterfaceBuilder()
  30. configureInspectableProperties()
  31. }
  32. open override func awakeFromNib() {
  33. super.awakeFromNib()
  34. configureInspectableProperties()
  35. }
  36. // MARK: - Private
  37. fileprivate func configureInspectableProperties() {
  38. configureAnimatableProperties()
  39. }
  40. }