Search code examples
iosswiftavplayerlayer

Why does .isHidden cause a dissolve animation?


I have the bellow line:

  playerLayer.isHidden = true

For some reason when its called, the playerLayer does a dissolve animation out.

Why does this happen and how can I prevent that?

Declaration of player layer.

        media.playerLayer = AVPlayerLayer(player: media.playerQueue)

Solution

  • Why does this happen

    Because animation is the default when setting a layer property.

    and how can I prevent that?

    Use CATransaction to disable animation.