diff --git a/dev/benchmarks/macrobenchmarks/ios/Runner/AppDelegate.m b/dev/benchmarks/macrobenchmarks/ios/Runner/AppDelegate.m index 59a72e90be..70e83933db 100644 --- a/dev/benchmarks/macrobenchmarks/ios/Runner/AppDelegate.m +++ b/dev/benchmarks/macrobenchmarks/ios/Runner/AppDelegate.m @@ -1,5 +1,5 @@ -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" +#import "AppDelegate.h" +#import "GeneratedPluginRegistrant.h" @implementation AppDelegate diff --git a/dev/integration_tests/android_views/ios/Podfile b/dev/integration_tests/android_views/ios/Podfile index 64ba7492ea..8d3767dad0 100644 --- a/dev/integration_tests/android_views/ios/Podfile +++ b/dev/integration_tests/android_views/ios/Podfile @@ -33,6 +33,8 @@ def parse_KV_file(file, separator='=') end target 'Runner' do + use_modular_headers! + # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock # referring to absolute paths on developers' machines. system('rm -rf .symlinks') diff --git a/dev/integration_tests/android_views/ios/Runner/AppDelegate.m b/dev/integration_tests/android_views/ios/Runner/AppDelegate.m index e5b5ebef57..2d60b90a47 100644 --- a/dev/integration_tests/android_views/ios/Runner/AppDelegate.m +++ b/dev/integration_tests/android_views/ios/Runner/AppDelegate.m @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" +#import "AppDelegate.h" +#import "GeneratedPluginRegistrant.h" @implementation AppDelegate diff --git a/dev/integration_tests/channels/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/dev/integration_tests/channels/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/dev/integration_tests/channels/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/dev/integration_tests/channels/ios/Runner/AppDelegate.m b/dev/integration_tests/channels/ios/Runner/AppDelegate.m index b2c2c16d06..4803d4e3ec 100644 --- a/dev/integration_tests/channels/ios/Runner/AppDelegate.m +++ b/dev/integration_tests/channels/ios/Runner/AppDelegate.m @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" +#import "AppDelegate.h" +#import "GeneratedPluginRegistrant.h" @interface Pair : NSObject @property(atomic, readonly, strong, nullable) NSObject* left; diff --git a/dev/integration_tests/codegen/ios/Runner/AppDelegate.m b/dev/integration_tests/codegen/ios/Runner/AppDelegate.m index 59a72e90be..70e83933db 100644 --- a/dev/integration_tests/codegen/ios/Runner/AppDelegate.m +++ b/dev/integration_tests/codegen/ios/Runner/AppDelegate.m @@ -1,5 +1,5 @@ -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" +#import "AppDelegate.h" +#import "GeneratedPluginRegistrant.h" @implementation AppDelegate diff --git a/dev/integration_tests/external_ui/ios/Runner/AppDelegate.m b/dev/integration_tests/external_ui/ios/Runner/AppDelegate.m index 83d3f88467..7e37eebb59 100644 --- a/dev/integration_tests/external_ui/ios/Runner/AppDelegate.m +++ b/dev/integration_tests/external_ui/ios/Runner/AppDelegate.m @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "AppDelegate.h" +#import "AppDelegate.h" @interface AppDelegate () @property (atomic) uint64_t textureId; diff --git a/dev/integration_tests/flavors/ios/Runner/AppDelegate.m b/dev/integration_tests/flavors/ios/Runner/AppDelegate.m index 11b40785e9..2715abd38d 100644 --- a/dev/integration_tests/flavors/ios/Runner/AppDelegate.m +++ b/dev/integration_tests/flavors/ios/Runner/AppDelegate.m @@ -1,5 +1,5 @@ -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" +#import "AppDelegate.h" +#import "GeneratedPluginRegistrant.h" @implementation AppDelegate diff --git a/dev/integration_tests/ios_add2app/Podfile b/dev/integration_tests/ios_add2app/Podfile index 11981e2fe2..45fe132708 100644 --- a/dev/integration_tests/ios_add2app/Podfile +++ b/dev/integration_tests/ios_add2app/Podfile @@ -5,6 +5,7 @@ flutter_application_path = 'flutterapp/' load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb') target 'ios_add2app' do + use_modular_headers! install_all_flutter_pods(flutter_application_path) end diff --git a/dev/integration_tests/ios_host_app/Host/ViewController.m b/dev/integration_tests/ios_host_app/Host/ViewController.m index 8e7df10d95..40ba459b8b 100644 --- a/dev/integration_tests/ios_host_app/Host/ViewController.m +++ b/dev/integration_tests/ios_host_app/Host/ViewController.m @@ -1,6 +1,11 @@ #import "ViewController.h" -#import -#import + +@import Flutter; +@import FlutterPluginRegistrant; + +// Prove plugins can be module-imported from the host app. +@import device_info; +@import google_maps_flutter; @implementation ViewController diff --git a/dev/integration_tests/ios_host_app/Podfile b/dev/integration_tests/ios_host_app/Podfile index a74eec912b..a27bec99d9 100644 --- a/dev/integration_tests/ios_host_app/Podfile +++ b/dev/integration_tests/ios_host_app/Podfile @@ -4,5 +4,6 @@ flutter_application_path = '../hello' load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb') target 'Host' do + use_modular_headers! install_all_flutter_pods flutter_application_path end diff --git a/dev/integration_tests/ios_host_app_swift/Host/AppDelegate.swift b/dev/integration_tests/ios_host_app_swift/Host/AppDelegate.swift index 9cc8e7704a..34fd691dd5 100644 --- a/dev/integration_tests/ios_host_app_swift/Host/AppDelegate.swift +++ b/dev/integration_tests/ios_host_app_swift/Host/AppDelegate.swift @@ -1,5 +1,9 @@ import UIKit +// Prove plugins can be module-imported from the host app. +import device_info +import google_maps_flutter + @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { diff --git a/dev/integration_tests/ios_host_app_swift/Podfile b/dev/integration_tests/ios_host_app_swift/Podfile index a74eec912b..a27bec99d9 100644 --- a/dev/integration_tests/ios_host_app_swift/Podfile +++ b/dev/integration_tests/ios_host_app_swift/Podfile @@ -4,5 +4,6 @@ flutter_application_path = '../hello' load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb') target 'Host' do + use_modular_headers! install_all_flutter_pods flutter_application_path end diff --git a/dev/integration_tests/platform_interaction/ios/Runner/AppDelegate.m b/dev/integration_tests/platform_interaction/ios/Runner/AppDelegate.m index dfa4361f4b..31917e81b0 100644 --- a/dev/integration_tests/platform_interaction/ios/Runner/AppDelegate.m +++ b/dev/integration_tests/platform_interaction/ios/Runner/AppDelegate.m @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" +#import "AppDelegate.h" +#import "GeneratedPluginRegistrant.h" @implementation AppDelegate diff --git a/dev/integration_tests/release_smoke_test/ios/Podfile b/dev/integration_tests/release_smoke_test/ios/Podfile index 64ba7492ea..89b9a88d70 100644 --- a/dev/integration_tests/release_smoke_test/ios/Podfile +++ b/dev/integration_tests/release_smoke_test/ios/Podfile @@ -33,6 +33,8 @@ def parse_KV_file(file, separator='=') end target 'Runner' do + use_modular_headers! + # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock # referring to absolute paths on developers' machines. system('rm -rf .symlinks') diff --git a/dev/integration_tests/release_smoke_test/ios/Runner/AppDelegate.m b/dev/integration_tests/release_smoke_test/ios/Runner/AppDelegate.m index 59a72e90be..70e83933db 100644 --- a/dev/integration_tests/release_smoke_test/ios/Runner/AppDelegate.m +++ b/dev/integration_tests/release_smoke_test/ios/Runner/AppDelegate.m @@ -1,5 +1,5 @@ -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" +#import "AppDelegate.h" +#import "GeneratedPluginRegistrant.h" @implementation AppDelegate diff --git a/dev/integration_tests/ui/ios/Runner/AppDelegate.m b/dev/integration_tests/ui/ios/Runner/AppDelegate.m index dfa4361f4b..31917e81b0 100644 --- a/dev/integration_tests/ui/ios/Runner/AppDelegate.m +++ b/dev/integration_tests/ui/ios/Runner/AppDelegate.m @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" +#import "AppDelegate.h" +#import "GeneratedPluginRegistrant.h" @implementation AppDelegate diff --git a/dev/manual_tests/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/dev/manual_tests/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/dev/manual_tests/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/dev/manual_tests/ios/Runner/AppDelegate.m b/dev/manual_tests/ios/Runner/AppDelegate.m index 74db37fda5..42700962af 100644 --- a/dev/manual_tests/ios/Runner/AppDelegate.m +++ b/dev/manual_tests/ios/Runner/AppDelegate.m @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" +#import "AppDelegate.h" +#import "GeneratedPluginRegistrant.h" @implementation AppDelegate diff --git a/examples/catalog/ios/Runner/AppDelegate.m b/examples/catalog/ios/Runner/AppDelegate.m index d4277583c2..109febb654 100644 --- a/examples/catalog/ios/Runner/AppDelegate.m +++ b/examples/catalog/ios/Runner/AppDelegate.m @@ -1,5 +1,5 @@ -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" +#import "AppDelegate.h" +#import "GeneratedPluginRegistrant.h" @implementation AppDelegate diff --git a/examples/flutter_gallery/ios/Podfile b/examples/flutter_gallery/ios/Podfile index e8ba04f2f4..61291f15f2 100644 --- a/examples/flutter_gallery/ios/Podfile +++ b/examples/flutter_gallery/ios/Podfile @@ -27,6 +27,8 @@ def parse_KV_file(file,separator='=') end target 'Runner' do + use_modular_headers! + # Flutter Pods pod 'Flutter', :path => ENV['FLUTTER_FRAMEWORK_DIR'] diff --git a/examples/flutter_gallery/ios/Runner/AppDelegate.m b/examples/flutter_gallery/ios/Runner/AppDelegate.m index ef69bf5591..39cdc5bfc6 100644 --- a/examples/flutter_gallery/ios/Runner/AppDelegate.m +++ b/examples/flutter_gallery/ios/Runner/AppDelegate.m @@ -1,5 +1,5 @@ -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" +#import "AppDelegate.h" +#import "GeneratedPluginRegistrant.h" @implementation AppDelegate diff --git a/examples/flutter_view/ios/Podfile b/examples/flutter_view/ios/Podfile index f29633fb28..827fe47bed 100644 --- a/examples/flutter_view/ios/Podfile +++ b/examples/flutter_view/ios/Podfile @@ -7,6 +7,7 @@ install! 'cocoapods', :disable_input_output_paths => true target 'Runner' do # Uncomment this line if you're using Swift or would like to use dynamic frameworks use_frameworks! + use_modular_headers! # Pods for Runner pod 'MaterialControls', '~> 1.2.2' diff --git a/examples/flutter_view/ios/Runner/AppDelegate.m b/examples/flutter_view/ios/Runner/AppDelegate.m index c92e987279..cd6c623ccf 100644 --- a/examples/flutter_view/ios/Runner/AppDelegate.m +++ b/examples/flutter_view/ios/Runner/AppDelegate.m @@ -1,4 +1,4 @@ -#include "AppDelegate.h" +#import "AppDelegate.h" #import @implementation AppDelegate diff --git a/examples/hello_world/ios/Runner/AppDelegate.m b/examples/hello_world/ios/Runner/AppDelegate.m index b1a0c02274..cafbf73264 100644 --- a/examples/hello_world/ios/Runner/AppDelegate.m +++ b/examples/hello_world/ios/Runner/AppDelegate.m @@ -1,5 +1,5 @@ -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" +#import "AppDelegate.h" +#import "GeneratedPluginRegistrant.h" @implementation AppDelegate diff --git a/examples/hello_world/ios/Runner/GeneratedPluginRegistrant.h b/examples/hello_world/ios/Runner/GeneratedPluginRegistrant.h index 3b700eb481..ed9a5c6169 100644 --- a/examples/hello_world/ios/Runner/GeneratedPluginRegistrant.h +++ b/examples/hello_world/ios/Runner/GeneratedPluginRegistrant.h @@ -7,8 +7,11 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface GeneratedPluginRegistrant : NSObject + (void)registerWithRegistry:(NSObject*)registry; @end +NS_ASSUME_NONNULL_END #endif /* GeneratedPluginRegistrant_h */ diff --git a/examples/image_list/ios/Runner/AppDelegate.m b/examples/image_list/ios/Runner/AppDelegate.m index 59a72e90be..70e83933db 100644 --- a/examples/image_list/ios/Runner/AppDelegate.m +++ b/examples/image_list/ios/Runner/AppDelegate.m @@ -1,5 +1,5 @@ -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" +#import "AppDelegate.h" +#import "GeneratedPluginRegistrant.h" @implementation AppDelegate diff --git a/examples/layers/ios/Runner/AppDelegate.m b/examples/layers/ios/Runner/AppDelegate.m index 74db37fda5..42700962af 100644 --- a/examples/layers/ios/Runner/AppDelegate.m +++ b/examples/layers/ios/Runner/AppDelegate.m @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" +#import "AppDelegate.h" +#import "GeneratedPluginRegistrant.h" @implementation AppDelegate diff --git a/examples/platform_view/ios/Podfile b/examples/platform_view/ios/Podfile index 0938dafd63..8c87860110 100644 --- a/examples/platform_view/ios/Podfile +++ b/examples/platform_view/ios/Podfile @@ -27,6 +27,8 @@ def parse_KV_file(file, separator='=') end target 'Runner' do + use_modular_headers! + # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock # referring to absolute paths on developers' machines. system('rm -rf .symlinks') diff --git a/examples/platform_view/ios/Runner/AppDelegate.m b/examples/platform_view/ios/Runner/AppDelegate.m index 8088f13f0f..48eae2ca50 100644 --- a/examples/platform_view/ios/Runner/AppDelegate.m +++ b/examples/platform_view/ios/Runner/AppDelegate.m @@ -2,9 +2,9 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" -#include "PlatformViewController.h" +#import "AppDelegate.h" +#import "GeneratedPluginRegistrant.h" +#import "PlatformViewController.h" @implementation AppDelegate { FlutterResult _flutterResult; diff --git a/examples/stocks/ios/Runner/AppDelegate.m b/examples/stocks/ios/Runner/AppDelegate.m index 74db37fda5..42700962af 100644 --- a/examples/stocks/ios/Runner/AppDelegate.m +++ b/examples/stocks/ios/Runner/AppDelegate.m @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" +#import "AppDelegate.h" +#import "GeneratedPluginRegistrant.h" @implementation AppDelegate diff --git a/packages/flutter_tools/lib/src/plugins.dart b/packages/flutter_tools/lib/src/plugins.dart index 997188fa10..b99c3bb9b4 100644 --- a/packages/flutter_tools/lib/src/plugins.dart +++ b/packages/flutter_tools/lib/src/plugins.dart @@ -454,10 +454,13 @@ const String _objcPluginRegistryHeaderTemplate = '''// #import <{{framework}}/{{framework}}.h> +NS_ASSUME_NONNULL_BEGIN + @interface GeneratedPluginRegistrant : NSObject + (void)registerWithRegistry:(NSObject*)registry; @end +NS_ASSUME_NONNULL_END #endif /* GeneratedPluginRegistrant_h */ '''; @@ -466,10 +469,15 @@ const String _objcPluginRegistryImplementationTemplate = '''// // #import "GeneratedPluginRegistrant.h" -{{#plugins}} -#import <{{name}}/{{class}}.h> -{{/plugins}} +{{#plugins}} +#if __has_include(<{{name}}/{{class}}.h>) +#import <{{name}}/{{class}}.h> +#else +@import {{name}}; +#endif + +{{/plugins}} @implementation GeneratedPluginRegistrant + (void)registerWithRegistry:(NSObject*)registry { diff --git a/packages/flutter_tools/templates/app/ios-objc.tmpl/Runner/AppDelegate.m b/packages/flutter_tools/templates/app/ios-objc.tmpl/Runner/AppDelegate.m index 59a72e90be..70e83933db 100644 --- a/packages/flutter_tools/templates/app/ios-objc.tmpl/Runner/AppDelegate.m +++ b/packages/flutter_tools/templates/app/ios-objc.tmpl/Runner/AppDelegate.m @@ -1,5 +1,5 @@ -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" +#import "AppDelegate.h" +#import "GeneratedPluginRegistrant.h" @implementation AppDelegate diff --git a/packages/flutter_tools/templates/cocoapods/Podfile-ios-objc b/packages/flutter_tools/templates/cocoapods/Podfile-ios-objc index 64ba7492ea..89b9a88d70 100644 --- a/packages/flutter_tools/templates/cocoapods/Podfile-ios-objc +++ b/packages/flutter_tools/templates/cocoapods/Podfile-ios-objc @@ -33,6 +33,8 @@ def parse_KV_file(file, separator='=') end target 'Runner' do + use_modular_headers! + # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock # referring to absolute paths on developers' machines. system('rm -rf .symlinks') diff --git a/packages/flutter_tools/templates/cocoapods/Podfile-ios-swift b/packages/flutter_tools/templates/cocoapods/Podfile-ios-swift index e9286cbac1..1f7a48426f 100644 --- a/packages/flutter_tools/templates/cocoapods/Podfile-ios-swift +++ b/packages/flutter_tools/templates/cocoapods/Podfile-ios-swift @@ -34,6 +34,7 @@ end target 'Runner' do use_frameworks! + use_modular_headers! # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock # referring to absolute paths on developers' machines. diff --git a/packages/flutter_tools/templates/cocoapods/Podfile-macos b/packages/flutter_tools/templates/cocoapods/Podfile-macos index 252ecc8add..d60ec71028 100644 --- a/packages/flutter_tools/templates/cocoapods/Podfile-macos +++ b/packages/flutter_tools/templates/cocoapods/Podfile-macos @@ -44,6 +44,7 @@ end target 'Runner' do use_frameworks! + use_modular_headers! # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock # referring to absolute paths on developers' machines. diff --git a/packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/AppDelegate.m b/packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/AppDelegate.m index 9b9ce33276..c83a5f3788 100644 --- a/packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/AppDelegate.m +++ b/packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/AppDelegate.m @@ -1,4 +1,4 @@ -#include "AppDelegate.h" +#import "AppDelegate.h" @implementation AppDelegate diff --git a/packages/flutter_tools/templates/module/ios/host_app_ephemeral_cocoapods/Podfile.copy.tmpl b/packages/flutter_tools/templates/module/ios/host_app_ephemeral_cocoapods/Podfile.copy.tmpl index 8965230aa7..d1a8e65e7b 100644 --- a/packages/flutter_tools/templates/module/ios/host_app_ephemeral_cocoapods/Podfile.copy.tmpl +++ b/packages/flutter_tools/templates/module/ios/host_app_ephemeral_cocoapods/Podfile.copy.tmpl @@ -6,6 +6,8 @@ load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb') use_frameworks! target 'Runner' do + use_modular_headers! + install_flutter_engine_pod install_flutter_plugin_pods flutter_application_path end diff --git a/packages/flutter_tools/templates/module/ios/host_app_ephemeral_cocoapods/Runner.tmpl/AppDelegate.m b/packages/flutter_tools/templates/module/ios/host_app_ephemeral_cocoapods/Runner.tmpl/AppDelegate.m index cb3bdff863..7644d81dcb 100644 --- a/packages/flutter_tools/templates/module/ios/host_app_ephemeral_cocoapods/Runner.tmpl/AppDelegate.m +++ b/packages/flutter_tools/templates/module/ios/host_app_ephemeral_cocoapods/Runner.tmpl/AppDelegate.m @@ -1,4 +1,4 @@ -#include "AppDelegate.h" +#import "AppDelegate.h" #import "FlutterPluginRegistrant/GeneratedPluginRegistrant.h" @implementation AppDelegate