Flutter iOS Embedder
FlutterSharedApplication.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 #include "flutter/fml/logging.h"
9 
11 
12 @implementation FlutterSharedApplication
13 
14 + (BOOL)isAppExtension {
15  NSDictionary* nsExtension = [NSBundle.mainBundle objectForInfoDictionaryKey:@"NSExtension"];
16  return [nsExtension isKindOfClass:[NSDictionary class]];
17 }
18 
19 + (BOOL)isAvailable {
20  // If the bundle is an App Extension, the application is not available.
21  // Therefore access to `UIApplication.sharedApplication` is not allowed.
23 }
24 
25 + (UIApplication*)application {
27  return FlutterSharedApplication.sharedApplication;
28  }
29  return nil;
30 }
31 
32 + (UIApplication*)
33  sharedApplication NS_EXTENSION_UNAVAILABLE_IOS("Accesses unavailable sharedApplication.") {
34  return UIApplication.sharedApplication;
35 }
36 
37 @end