Flutter Engine
The Flutter Engine
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#include "flutter/fml/logging.h"
8#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterMacros.h"
9
11
13
14- (UIWindowScene*)flutterWindowSceneIfViewLoaded {
15 if (self.viewIfLoaded == nil) {
16 FML_LOG(WARNING) << "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 (@available(iOS 13.0, *)) {
24 if (self.viewIfLoaded == nil) {
25 FML_LOG(WARNING) << "Trying to access the screen before the view is loaded.";
26 return nil;
27 }
28 return [self flutterWindowSceneIfViewLoaded].screen;
29 }
30 return UIScreen.mainScreen;
31}
32
33@end
#define FML_LOG(severity)
Definition: logging.h:82