SwiftFortuneWheel
public class SwiftFortuneWheel : SFWControl
extension SwiftFortuneWheel: SliceCalculating
extension SwiftFortuneWheel: ImpactFeedbackable
extension SwiftFortuneWheel: AudioPlayable
extension SwiftFortuneWheel: SpinningAnimatorProtocol
Customizable Fortune spinning wheel control written in Swift.
-
Called when spin button tapped
Declaration
Swift
public var onSpinButtonTap: (() -> Void)? -
Callback for edge collision
Declaration
Swift
public var onEdgeCollision: ((_ progress: Double?) -> Void)? -
Callback for center collision
Declaration
Swift
public var onCenterCollision: ((_ progress: Double?) -> Void)? -
Callback for
wheelViewtap, returns selected indexDeclaration
Swift
public var onWheelTap: ((_ index: Int) -> Void)? -
Turns on tap gesture recognizer for
wheelViewDeclaration
Swift
public var wheelTapGestureOn: Bool { get set } -
Declaration
Swift
public var impactFeedbackOn: Bool { get set } -
Declaration
Swift
public var edgeCollisionDetectionOn: Bool -
Declaration
Swift
public var centerCollisionDetectionOn: Bool -
Declaration
Swift
public var edgeCollisionSound: AudioFile? { get set } -
Declaration
Swift
public var centerCollisionSound: AudioFile? { get set } -
PinImageViewcollision effect configuratorDeclaration
Swift
public var pinImageViewCollisionEffect: CollisionEffect? -
Customizable configuration. Required in order to draw properly.
Declaration
Swift
public var configuration: SFWConfiguration? { get set } -
List of Slice objects. Used to draw content.
Declaration
Swift
open var slices: [Slice] { get set } -
Audio player manager, used for collision effects sound
Declaration
Swift
private(set) lazy var audioPlayerManager: AudioPlayerManager { get set } -
Undocumented
Declaration
Swift
private(set) lazy var impactFeedbackgenerator: UIImpactFeedbackGenerator { get set } -
Initiates without IB.
Declaration
Swift
public init(frame: CGRect, slices: [Slice], configuration: SFWConfiguration?)Parameters
frameFrame
slicesList of Slices
configurationCustomizable configuration
-
Undocumented
Declaration
Swift
public required init?(coder aDecoder: NSCoder) -
-
-
-
Undocumented
Declaration
Swift
override public func layoutSubviews() -
-
/ Animation conformance
Declaration
Swift
var layerToAnimate: SpinningAnimatable? { get } -
Declaration
Swift
var sliceDegree: CGFloat? { get } -
Declaration
Swift
var edgeAnchorRotationOffset: CGFloat { get } -
Declaration
Swift
var centerAnchorRotationOffset: CGFloat { get }
-
Rotates to the specified index
Declaration
Swift
func rotate(toIndex index: Int, animationDuration: CFTimeInterval = 0.00001)Parameters
indexIndex
animationDurationAnimation duration
-
Rotates to the specified angle offset
Declaration
Swift
func rotate(rotationOffset: CGFloat, animationDuration: CFTimeInterval = 0.00001)Parameters
rotationOffsetRotation offset
animationDurationAnimation duration
-
Starts rotation animation and stops rotation at the specified rotation offset angle
Declaration
Swift
func startRotationAnimation(rotationOffset: CGFloat, fullRotationsCount: Int = 13, animationDuration: CFTimeInterval = 5.000, _ completion: ((Bool) -> Void)?)Parameters
rotationOffsetRotation offset
fullRotationsCountFull rotations until start deceleration
animationDurationAnimation duration
completionCompletion handler
-
Starts rotation animation and stops rotation at the specified index
Declaration
Swift
func startRotationAnimation(finishIndex: Int, fullRotationsCount: Int = 13, animationDuration: CFTimeInterval = 5.000, _ completion: ((Bool) -> Void)?)Parameters
finishIndexFinish at index
fullRotationsUntilFinishFull rotations until start deceleration
animationDurationAnimation duration
completionCompletion handler
-
Starts indefinite rotation and stops rotation at the specified index
Declaration
Swift
func startRotationAnimation(finishIndex: Int, continuousRotationTime: Int, continuousRotationSpeed: CGFloat = 4, _ completion: ((Bool) -> Void)?)Parameters
finishIndexFinish at index
continuousRotationTimeFull rotation time in seconds before stops
continuousRotationSpeedRotation speed
completionCompletion handler
-
startRotationAnimation(finishIndex:continuousRotationTime: continuousRotationSpeed: rotationOffset: _: ) Starts indefinite rotation and stops rotation at the specified index
Declaration
Swift
func startRotationAnimation(finishIndex: Int, continuousRotationTime: Int, continuousRotationSpeed: CGFloat = 4, rotationOffset: CGFloat = 0, _ completion: ((Bool) -> Void)?)Parameters
finishIndexFinish at index
continuousRotationTimeFull rotation time in seconds before stops
continuousRotationSpeedRotation speed
rotationOffsetRotation offset
completionCompletion handler
-
Starts continuos rotation animation
Declaration
Swift
func startContinuousRotationAnimation(with speed: CGFloat = 4)Parameters
speedRotation speed
-
Stops rotation animation
Declaration
Swift
func stopRotation() -
Starts rotation animation and stops rotation at the specified index and rotation angle offset
Declaration
Swift
func startRotationAnimation(finishIndex: Int, rotationOffset: CGFloat, fullRotationsCount: Int = 13, animationDuration: CFTimeInterval = 5.000, _ completion: ((Bool) -> Void)?)Parameters
finishIndexfinished at index
rotationOffsetRotation offset
fullRotationsUntilFinishFull rotations until start deceleration
animationDurationAnimation duration
completioncompletion
-
Pin image name from assets catalog, sets image to the
pinImageViewDeclaration
Swift
@IBInspectable var pinImage: String? { get set } -
is
pinImageViewhiddenDeclaration
Swift
@IBInspectable var isPinHidden: Bool { get set } -
Spin button image name from assets catalog, sets image to the
spinButtonDeclaration
Swift
@IBInspectable var spinImage: String? { get set } -
Spin button background image from assets catalog, sets background image to the
spinButtonDeclaration
Swift
@IBInspectable var spinBackgroundImage: String? { get set } -
Spin button title text, sets title text to the
spinButtonDeclaration
Swift
@IBInspectable var spinTitle: String? { get set } -
Is
spinButtonhiddenDeclaration
Swift
@IBInspectable var isSpinHidden: Bool { get set } -
Is
spinButtonenabledDeclaration
Swift
@IBInspectable var isSpinEnabled: Bool { get set }
-
Starts indefinite rotation animation
Declaration
Swift
@available(*, deprecated, message: "Use startContinuousRotationAnimation(with: speed﹚ instead") func startAnimating(rotationTime: CFTimeInterval = 5.000, fullRotationCountInRotationTime: CGFloat = 7000)Parameters
rotationTimeRotation time is how many seconds needs to rotate all full rotation counts, default value is
5.000fullRotationCountInRotationTimeHow many rotation should be done for spefied rotation time, default value is
7000 -
Stops all animations
Declaration
Swift
@available(*, deprecated, renamed: "stopRotation") func stopAnimating() -
Starts indefinite rotation and stops rotation at the specified index
Declaration
Swift
@available(*, deprecated, message: "Use startRotationAnimation(finishIndex:continuousRotationTime:completion:﹚ instead") func startAnimating(indefiniteRotationTimeInSeconds: Int, finishIndex: Int, _ completion: ((Bool) -> Void)?)Parameters
indefiniteRotationTimeInSecondsfull rotation time in seconds before stops
finishIndexfinished at index
completioncompletion
-
Starts rotation animation and stops rotation at the specified index and rotation angle offset
Declaration
Swift
@available(*, deprecated, renamed: "startRotationAnimation(finishIndex:rotationOffset:fullRotationsCount:animationDuration:completion:﹚") func startAnimating(finishIndex: Int, rotationOffset: CGFloat, fullRotationsUntilFinish: Int = 13, animationDuration: CFTimeInterval = 5.000, _ completion: ((Bool) -> Void)?)Parameters
finishIndexfinished at index
rotationOffsetRotation offset
fullRotationsUntilFinishFull rotations until start deceleration
animationDurationAnimation duration
completioncompletion
-
Starts rotation animation and stops rotation at the specified rotation offset angle
Declaration
Swift
@available(*, deprecated, renamed: "startRotationAnimation(rotationOffset:fullRotationsCount:animationDuration:completion:﹚") func startAnimating(rotationOffset: CGFloat, fullRotationsUntilFinish: Int = 13, animationDuration: CFTimeInterval = 5.000, _ completion: ((Bool) -> Void)?)Parameters
rotationOffsetRotation offset
fullRotationsUntilFinishFull rotations until start deceleration
animationDurationAnimation duration
completionCompletion handler
-
Starts rotation animation and stops rotation at the specified index
Declaration
Swift
@available(*, deprecated, renamed: "startRotationAnimation(finishIndex:fullRotationsCount:animationDuration:completion:﹚") func startAnimating(finishIndex: Int, fullRotationsUntilFinish: Int = 13, animationDuration: CFTimeInterval = 5.000, _ completion: ((Bool) -> Void)?)Parameters
finishIndexFinish at index
fullRotationsUntilFinishFull rotations until start deceleration
animationDurationAnimation duration
completionCompletion handler
SwiftFortuneWheel Class Reference