Skip to content

Rewind one story #12

@michael-martinez

Description

@michael-martinez

I am trying to load a previous story but cannot manage to do so.

Here is the function I am trying to implement which should be the opposite action to skip() :

func rewindOne() {
let currentSegment = segments[currentAnimationIndex]
currentSegment.topSegmentView.frame.size.width = 0
currentSegment.topSegmentView.layer.removeAllAnimations()

var newIndex = self.currentAnimationIndex - 1
    if newIndex < 0 { newIndex = 0 }
    
    if newIndex >= 0 {
        self.delegate?.segmentedProgressBarChangedIndex(index: newIndex)
        self.animate(animationIndex: newIndex)
    }

}

The animation does not stop, I have 3 items, tried:
segments.forEach {
$0.topSegmentView.layer.removeAllAnimations()
}
The segment keeps being animated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions