-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAppDelegate.swift
executable file
·44 lines (33 loc) · 1.41 KB
/
AppDelegate.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// AppDelegate.swift
// WYBasisKit
//
// Created by 官人 on 2020/8/29.
// Copyright © 2020 官人. All rights reserved.
// os(iOS) os(iPadOS) os(tvOS) os(watchOS) os(macOS) os(visionOS) targetEnvironment(macCatalyst)
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
// 屏蔽控制台约束输出
UserDefaults.standard.setValue(false, forKey: "_UIConstraintBasedLayoutLogUnsatisfiable")
return true
}
/// 切换为深色或浅色模式
func applicationDidBecomeActive(_ application: UIApplication) {
if #available(iOS 13.0, *) {
application.wy_switchAppDisplayBrightness(style: (WYLocalizableManager.currentLanguage() == .english) ? .dark : .light)
}
}
/// 屏幕旋转需要支持的方向
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return UIDevice.current.wy_currentInterfaceOrientation
}
}
extension AppDelegate {
class func shared() -> AppDelegate {
return UIApplication.shared.delegate as! AppDelegate
}
}