'statusBarOrientation' was deprecated in Mac Catalyst 13.0

I am using the following code to find out if the iPad is landscape or portrait in the face up or face down orientation to layout UICollectionView Cell... But I am getting the error "'statusBarOrientation' was deprecated in Mac Catalyst 13.0: Use the interfaceOrientation property of the window scene instead."


My Code looks something like this:


if UIApplication.shared.statusBarOrientation.isPortrait {
let spacing = self.view.frame.size.width - 15
let itemWidth = spacing / 2
sizeArea = CGSize(width: itemWidth, height: itemWidth)
}