//
//  UIView+Mode.swift
//  1Weather
//
//  Created by Dmitry Stepanets on 23.03.2021.
//

import UIKit

public enum AppInterfaceStyle {
    case light
    case dark
}

extension UIView {
    var interfaceStyle:AppInterfaceStyle {
        switch Settings.shared.appTheme {
        case .light:
            return .light
        case .dark:
            return .dark
        case .system:
            if #available(iOS 12.0, *) {
                return traitCollection.userInterfaceStyle == .light ? .light : .dark
            }
            else {
                return .light
            }
        }
    }
}
