I have a bar style UIProgressView
. Progressbar has a gray background and white progress colour and I am animating progress change with 10 second time. On simulator (iOS 14.5) everything works fine, however, on real device (iOS 15) progressBar animates from gray to white colour. Therefore, at the beginning on fulfilled progress part, I see gray colour rather than white.
How I initialize my view:
let segment = UIProgressView(progressViewStyle: .bar)
segment.layer.cornerRadius = 3.0
segment.layer.masksToBounds = true
segment.snp.makeConstraints { make in
make.height.equalTo(4)
}
segment.progress = 0.0
segment.trackTintColor = UIColor.black.withAlphaComponent(0.2)
segment.progressTintColor = Colors.white
segment.tintColor = Colors.white
How I animate:
self.progressBar.progress = 1.0
animator = UIViewPropertyAnimator(duration: storyTime, curve: .linear, animations: {
self.progressBar.layoutIfNeeded()
})
animator?.addCompletion { [weak self] position in
guard let self = self else { return }
}
animator?.startAnimation()
On real device:
On simulator: