← Back to MengTo/Spring

How to Deploy & Use MengTo/Spring

Spring Animation Library - Deployment and Usage Guide

1. Prerequisites

  • Xcode 10 or later (required for Swift 4.2 support)
  • iOS 8.0 or later (minimum deployment target)
  • Swift 4.2 (required for this version)

2. Installation

Manual Installation

  1. Download the Spring library from GitHub
  2. Drag the Spring folder into your Xcode project
  3. Ensure "Copy items if needed" and "Create groups" are selected

CocoaPods Installation

Add the following to your Podfile:

use_frameworks!
pod 'Spring', :git => 'https://github.com/MengTo/Spring.git'

Then run:

pod install

3. Configuration

Storyboard Configuration

  1. Select your UIView in the Storyboard
  2. Open the Identity Inspector
  3. Change the class to SpringView
  4. Configure animation properties in the Attribute Inspector

Code Configuration

No additional configuration required. Simply import Spring and use the provided methods.

4. Build & Run

Local Development

  1. Import Spring in your Swift file:
import Spring
  1. Configure your view:
layer.animation = "squeezeDown"
layer.animate()

Available Animations

  • shake, pop, morph, squeeze, wobble, swing
  • flipX, flipY, fall, squeezeLeft, squeezeRight
  • squeezeDown, squeezeUp, slideLeft, slideRight
  • slideDown, slideUp, fadeIn, fadeOut
  • fadeInLeft, fadeInRight, fadeInDown, fadeInUp
  • zoomIn, zoomOut, flash

Animation Properties

  • force: CGFloat (default: 1)
  • duration: CGFloat (default: 1)
  • delay: CGFloat (default: 0)
  • damping: CGFloat (default: 0.7)
  • velocity: CGFloat (default: 0.7)
  • repeatCount: Float
  • scale: CGFloat
  • x: CGFloat
  • y: CGFloat
  • rotate: CGFloat

Animation Curves

  • spring, linear, easeIn, easeOut, easeInOut

5. Deployment

Distribution

  • App Store: Build and submit your app normally through Xcode
  • Enterprise Distribution: Use your enterprise certificate and provisioning profile
  • Ad Hoc: Use ad hoc provisioning for testing

Requirements

  • Ensure all Spring animations are properly tested on target devices
  • Verify that animations work correctly with your app's UI elements
  • Test on different screen sizes and iOS versions

6. Troubleshooting

Common Issues

Issue: Animations won't autostart when view is reached via performSegueWithIdentifier Solution: Manually trigger animations in viewDidAppear instead of relying on autostart.

Issue: Animations not working in Objective-C projects Solution: Follow the integration guide: Using Swift in Objective-C Projects

Issue: Properties not working together Solution: Not all properties work together. Test with the demo app to find compatible combinations.

Issue: Autostart not working Solution: Use autostart only when you don't plan to start animations in code. For programmatic control, set autostart to false.

Performance Tips

  • Use appropriate animation durations (typically 0.5-1.0 seconds)
  • Avoid excessive use of complex animations on low-end devices
  • Test animations on actual devices, not just simulators

Known Limitations

  • Some properties may conflict with each other
  • Complex animations may affect performance on older devices
  • Autostart has limitations with storyboard segues