File tree 1 file changed +9
-5
lines changed
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 2
2
// WindowUtils.swift
3
3
// TUIKitCommon
4
4
//
5
- // Created by 于西巍 on 2023/10/16.
5
+ // Created by krab on 2023/10/16.
6
6
//
7
7
8
8
import Foundation
@@ -18,7 +18,7 @@ public class WindowUtils {
18
18
}
19
19
return UIApplication . shared. windows. first
20
20
}
21
-
21
+
22
22
public static func getCurrentWindowViewController( ) -> UIViewController ? {
23
23
var keyWindow : UIWindow ?
24
24
for window in UIApplication . shared. windows {
@@ -53,8 +53,12 @@ public class WindowUtils {
53
53
}
54
54
55
55
public static var isPortrait : Bool {
56
- guard let isPortrait = UIApplication . shared. windows. first? . windowScene? . interfaceOrientation. isPortrait as? Bool
57
- else { return UIDevice . current. orientation. isPortrait }
58
- return isPortrait
56
+ if #available( iOS 13 . 0 , * ) {
57
+ guard let isPortrait = UIApplication . shared. windows. first? . windowScene? . interfaceOrientation. isPortrait as? Bool
58
+ else { return UIDevice . current. orientation. isPortrait }
59
+ return isPortrait
60
+ } else {
61
+ return UIDevice . current. orientation. isPortrait
62
+ }
59
63
}
60
64
}
You can’t perform that action at this time.
0 commit comments