Hey guys. I've created that function to animate my button:
But the problem is that animation does not finish. Alpha stays at around probably 85% from what I can see. Any help explaining what is wrong with this code will be appreciated! Many thanks.
Code Block private func animateButtonView(_ viewToAnimate: UIView) { UIView.animate(withDuration: 0.2, animations: {viewToAnimate.alpha = 0}) { [weak self] (true) in guard let self = self else { return } switch true { case true: DispatchQueue.main.async { self.addToFavoritesButton.setImage(SFSymbolsAsImg.checkmark, for: .normal) } UIView.animate(withDuration: 0.2, animations: {viewToAnimate.alpha = 1} ) case false: return } } }
But the problem is that animation does not finish. Alpha stays at around probably 85% from what I can see. Any help explaining what is wrong with this code will be appreciated! Many thanks.