diff --git a/packages/flutter_tools/templates/plugin_cocoapods/macos.tmpl/Resources/PrivacyInfo.xcprivacy b/packages/flutter_tools/templates/plugin_cocoapods/macos.tmpl/Resources/PrivacyInfo.xcprivacy
new file mode 100644
index 0000000000..918d80be43
--- /dev/null
+++ b/packages/flutter_tools/templates/plugin_cocoapods/macos.tmpl/Resources/PrivacyInfo.xcprivacy
@@ -0,0 +1,12 @@
+
+
+
+
+ NSPrivacyTrackingDomains
+
+ NSPrivacyCollectedDataTypes
+
+ NSPrivacyTracking
+
+
+
diff --git a/packages/flutter_tools/templates/plugin_shared/macos.tmpl/projectName.podspec.tmpl b/packages/flutter_tools/templates/plugin_shared/macos.tmpl/projectName.podspec.tmpl
index dc63236d22..fc0a6c33ee 100644
--- a/packages/flutter_tools/templates/plugin_shared/macos.tmpl/projectName.podspec.tmpl
+++ b/packages/flutter_tools/templates/plugin_shared/macos.tmpl/projectName.podspec.tmpl
@@ -26,6 +26,18 @@ Pod::Spec.new do |s|
{{^withSwiftPackageManager}}
s.source_files = 'Classes/**/*'
{{/withSwiftPackageManager}}
+
+ # If your plugin requires a privacy manifest, for example if it collects user
+ # data, update the PrivacyInfo.xcprivacy file to describe your plugin's
+ # privacy impact, and then uncomment this line. For more information,
+ # see https://developer.apple.com/documentation/bundleresources/privacy_manifest_files
+ {{#withSwiftPackageManager}}
+ # s.resource_bundles = {'{{projectName}}_privacy' => ['{{projectName}}/Sources/{{projectName}}/PrivacyInfo.xcprivacy']}
+ {{/withSwiftPackageManager}}
+ {{^withSwiftPackageManager}}
+ # s.resource_bundles = {'{{projectName}}_privacy' => ['Resources/PrivacyInfo.xcprivacy']}
+ {{/withSwiftPackageManager}}
+
s.dependency 'FlutterMacOS'
s.platform = :osx, '10.11'
diff --git a/packages/flutter_tools/templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Package.swift.tmpl b/packages/flutter_tools/templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Package.swift.tmpl
index 8625943765..f0dfc595af 100644
--- a/packages/flutter_tools/templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Package.swift.tmpl
+++ b/packages/flutter_tools/templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Package.swift.tmpl
@@ -17,7 +17,15 @@ let package = Package(
name: "{{projectName}}",
dependencies: [],
resources: [
- .process("Resources"),
+ // If your plugin requires a privacy manifest, for example if it collects user
+ // data, update the PrivacyInfo.xcprivacy file to describe your plugin's
+ // privacy impact, and then uncomment these lines. For more information, see
+ // https://developer.apple.com/documentation/bundleresources/privacy_manifest_files
+ // .process("PrivacyInfo.xcprivacy"),
+
+ // If you have other resources that need to be bundled with your plugin, refer to
+ // the following instructions to add them:
+ // https://developer.apple.com/documentation/xcode/bundling-resources-with-a-swift-package
]
)
]
diff --git a/packages/flutter_tools/templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Sources/projectName.tmpl/PrivacyInfo.xcprivacy b/packages/flutter_tools/templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Sources/projectName.tmpl/PrivacyInfo.xcprivacy
new file mode 100644
index 0000000000..918d80be43
--- /dev/null
+++ b/packages/flutter_tools/templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Sources/projectName.tmpl/PrivacyInfo.xcprivacy
@@ -0,0 +1,12 @@
+
+
+
+
+ NSPrivacyTrackingDomains
+
+ NSPrivacyCollectedDataTypes
+
+ NSPrivacyTracking
+
+
+
diff --git a/packages/flutter_tools/templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Sources/projectName.tmpl/Resources/.gitkeep b/packages/flutter_tools/templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Sources/projectName.tmpl/Resources/.gitkeep
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/packages/flutter_tools/templates/template_manifest.json b/packages/flutter_tools/templates/template_manifest.json
index fbcaab3082..f22b4f65fa 100644
--- a/packages/flutter_tools/templates/template_manifest.json
+++ b/packages/flutter_tools/templates/template_manifest.json
@@ -339,6 +339,7 @@
"templates/plugin_cocoapods/ios.tmpl/Assets/.gitkeep",
"templates/plugin_cocoapods/ios.tmpl/Resources/PrivacyInfo.xcprivacy",
"templates/plugin_cocoapods/macos.tmpl/Classes/pluginClass.swift.tmpl",
+ "templates/plugin_cocoapods/macos.tmpl/Resources/PrivacyInfo.xcprivacy",
"templates/plugin_swift_package_manager/ios-objc.tmpl/projectName.tmpl/Sources/projectName.tmpl/include/projectName.tmpl/pluginClass.h.tmpl",
"templates/plugin_swift_package_manager/ios-objc.tmpl/projectName.tmpl/Sources/projectName.tmpl/pluginClass.m.tmpl",
@@ -349,6 +350,7 @@
"templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Sources/projectName.tmpl/Resources/.gitkeep",
"templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Sources/projectName.tmpl/pluginClass.swift.tmpl",
"templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Package.swift.tmpl",
+ "templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Sources/projectName.tmpl/PrivacyInfo.xcprivacy",
"templates/skeleton/assets/images/2.0x/flutter_logo.png.img.tmpl",
"templates/skeleton/assets/images/3.0x/flutter_logo.png.img.tmpl",
diff --git a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart
index 1c5408fd0d..3cc6e62dc4 100644
--- a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart
+++ b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart
@@ -712,7 +712,7 @@ void main() {
testUsingContext('kotlin/swift plugin project without Swift Package Manager', () async {
return _createProject(
projectDir,
- ['--no-pub', '--template=plugin', '-a', 'kotlin', '--ios-language', 'swift', '--platforms', 'ios,android'],
+ ['--no-pub', '--template=plugin', '-a', 'kotlin', '--ios-language', 'swift', '--platforms', 'android,ios,macos'],
[
'analysis_options.yaml',
'android/src/main/kotlin/com/example/flutter_project/FlutterProjectPlugin.kt',
@@ -722,6 +722,8 @@ void main() {
'example/lib/main.dart',
'ios/Classes/FlutterProjectPlugin.swift',
'ios/Resources/PrivacyInfo.xcprivacy',
+ 'macos/Classes/FlutterProjectPlugin.swift',
+ 'macos/Resources/PrivacyInfo.xcprivacy',
'lib/flutter_project.dart',
],
unexpectedPaths: [
@@ -736,7 +738,7 @@ void main() {
);
}, overrides: {
// Test flags disable Swift Package Manager.
- FeatureFlags: () => TestFeatureFlags(),
+ FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
});
testUsingContext('swift plugin project with Swift Package Manager', () async {
@@ -749,7 +751,7 @@ void main() {
'ios/flutter_project/Sources/flutter_project/PrivacyInfo.xcprivacy',
'macos/flutter_project/Package.swift',
'macos/flutter_project/Sources/flutter_project/FlutterProjectPlugin.swift',
- 'macos/flutter_project/Sources/flutter_project/Resources/.gitkeep',
+ 'macos/flutter_project/Sources/flutter_project/PrivacyInfo.xcprivacy',
],
unexpectedPaths: [
'ios/Classes/FlutterProjectPlugin.swift',