| Flutter iOS Embedder |

UIViewController+FlutterScreenAndSceneIfLoaded.mm
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #import "flutter/shell/platform/darwin/ios/framework/Source/UIViewController+FlutterScreenAndSceneIfLoaded.h"
6
7 #import "flutter/shell/platform/darwin/common/InternalFlutterSwiftCommon/InternalFlutterSwiftCommon.h"
8 #import "flutter/shell/platform/darwin/common/framework/Headers/FlutterMacros.h"
9
10 FLUTTER_ASSERT_ARC
11
12 @implementation UIViewController (FlutterScreenAndSceneIfLoaded)
13
14 - (UIWindowScene*)flutterWindowSceneIfViewLoaded {
15 if (self.viewIfLoaded == nil) {
16 [FlutterLogger logWarning:@"Trying to access the window scene before the view is loaded."];
17 return nil;
18 }
19 return self.viewIfLoaded.window.windowScene;
20 }
21
22 - (UIScreen*)flutterScreenIfViewLoaded {
23 if (self.viewIfLoaded == nil) {
24 [FlutterLogger logWarning:@"Trying to access the screen before the view is loaded."];
25 return nil;
26 }
27 return [self flutterWindowSceneIfViewLoaded].screen;
28 }
29
30 @end
FlutterMacros.h
UIViewController+FlutterScreenAndSceneIfLoaded.h
UIViewController(FlutterScreenAndSceneIfLoaded)
Definition: UIViewController+FlutterScreenAndSceneIfLoaded.h:10
FLUTTER_ASSERT_ARC
Definition: FlutterChannelKeyResponder.mm:13