API_Overview.md
January 6, 2021 ยท View on GitHub
API Overview
Rotation API
Rotation API helps you to rotate to a slice index or to a specified angle, with or without animation.
- Rotates to the specified index.
If you need to rotate with animation, change the
animationDuration.
func rotate(toIndex index: Int, animationDuration: CFTimeInterval = 0.00001)
- Rotates to the specified angle offset.
If you need to rotate with animation, change the
animationDuration.
func rotate(rotationOffset: CGFloat, animationDuration: CFTimeInterval = 0.00001)
- Starts continuos rotation animation
func startContinuousRotationAnimation()
- Stops all animations
func stopRotation()
- Starts rotation animation and stops rotation at the specified index and rotation angle offset.
func startRotationAnimation(finishIndex: Int, rotationOffset: CGFloat, _ completion: ((Bool) -> Void)?)
- Starts rotation animation and stops rotation at the specified index.
func startRotationAnimation(finishIndex: Int, _ completion: ((Bool) -> Void)?)
- Starts rotation animation and stops rotation at the specified rotation offset angle.
func startRotationAnimation(rotationOffset: CGFloat, _ completion: ((Bool) -> Void)?)
- Starts continuos rotation and stops rotation at the specified index.
func startRotationAnimation(finishIndex: Int, continuousRotationTime: Int, _ completion: ((Bool) -> Void)?)
pinImageView and spinButton API
There some variables that can be set via Interface Builder or through code. However, if you need deeper customize pinImageView or spinButton, you need also use pinPreferences or spinButtonPreferences in the configuration parameter.
- Pin image name from assets catalog, sets image to the
pinImageView.
@IBInspectable var pinImage: String?
- is
pinImageViewhidden.
@IBInspectable var isPinHidden: Bool
- Spin button image name from assets catalog, sets image to the
spinButton.
@IBInspectable var spinImage: String?
- Spin button background image from assets catalog, sets background image to the
spinButton.
@IBInspectable var spinBackgroundImage: String?
- Spin button title text, sets title text to the
spinButton.
@IBInspectable var spinTitle: String?
- Is
spinButtonhidden.
@IBInspectable var isSpinHidden: Bool
- Is
spinButtonenabled.
@IBInspectable var isSpinEnabled: Bool
Tap Gesture API
- Select Index via tap gesture.
@IBOutlet weak var fortuneWheel: SwiftFortuneWheel! {
didSet {
//turns on tap gesture recognizer
fortuneWheel.wheelTapGestureOn = true
//selected index by tap
fortuneWheel.onWheelTap = { (index) in
print("tap to index: \(index)")
}
}
}