Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
folium-app
GitHub Repository: folium-app/Folium
Path: blob/a-new-beginning/Folium-iOS/Extensions/UIViewController.swift
2 views
//
//  UIViewController.swift
//  Folium-iOS
//
//  Created by Jarrod Norwell on 20/7/2025.
//

import UIKit

extension UIViewController {
    var iPhone: Bool {
        UIDevice.current.userInterfaceIdiom == .phone
    }
    
    func interfaceOrientation() -> UIInterfaceOrientation {
        guard let window = view.window, let windowScene = window.windowScene else {
            if UIDevice.current.orientation.isPortrait {
                return .portrait
            } else {
                if UIDevice.current.orientation == .landscapeLeft {
                    return .landscapeLeft
                } else {
                    return .landscapeRight
                }
            }
        }
        
        return windowScene.interfaceOrientation
    }
}