【SwiftUI】動画を角丸にしたい

AvKitで読み込んだ動画にCornerRadiusをかけると、動画自体が飛び出してしまいます。下の感じ。

VideoPlayer(player: player)
    .aspectRatio(4 / 3, contentMode: .fit)
    .overlay(
        RoundedRectangle(cornerRadius: 20)
            .stroke(Color.purple, lineWidth: 2)
    )

これを直すには以下のように.clipShapeを追加すること。意外と簡単だったね。

VideoPlayer(player: player)
    .aspectRatio(4 / 3, contentMode: .fit)
    .clipShape(RoundedRectangle(cornerRadius: 20))
    .overlay(
        RoundedRectangle(cornerRadius: 20)
            .stroke(Color.purple, lineWidth: 2)
    )