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 
6 
7 #import "flutter/shell/platform/darwin/common/InternalFlutterSwiftCommon/InternalFlutterSwiftCommon.h"
9 
11 
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