79771716

Date: 2025-09-22 14:15:49
Score: 2
Natty:
Report link

Thank you to @Larme for helping. With landscape only in target settings. This will give left or right even when the device is held in the portrait orientation.

if let windowScene = UIApplication.shared.connectedScenes
    .first(where: { $0 is UIWindowScene }) as? UIWindowScene {
    
    switch windowScene.interfaceOrientation {
    case .landscapeLeft:
        print("Landscape Left")
    case .landscapeRight:
        print("Landscape Right")
    }
}
Reasons:
  • Blacklisted phrase (0.5): Thank you
  • Has code block (-0.5):
  • User mentioned (1): @Larme
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: AthleteInAction