Add create app and plugin templates for Swift Package Manager (#147082)
When Swift Package Manager feature is enabled, create app and create plugin will have Swift Package Manager integration already added and will not need to undergo a migration. Fixes https://github.com/flutter/flutter/issues/146371. ``` flutter config --enable-swift-package-manager flutter create --ios-language swift --platforms ios,macos swift_app_name flutter create --ios-language objc --platforms ios objc_app_name flutter create --template=plugin --ios-language swift --platforms ios,macos swift_plugin_name flutter create --template=plugin --ios-language objc --platforms ios objc_plugin_name ```
This commit is contained in:
committed by
GitHub
parent
d85571b46b
commit
5a63b1df95
@@ -10,6 +10,9 @@
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||
331C80F4294D02FB00263BE5 /* RunnerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 331C80F3294D02FB00263BE5 /* RunnerTests.m */; };
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
{{#withSwiftPackageManager}}
|
||||
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; };
|
||||
{{/withSwiftPackageManager}}
|
||||
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
|
||||
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
@@ -71,6 +74,9 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
{{#withSwiftPackageManager}}
|
||||
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */,
|
||||
{{/withSwiftPackageManager}}
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -176,6 +182,11 @@
|
||||
dependencies = (
|
||||
);
|
||||
name = Runner;
|
||||
{{#withSwiftPackageManager}}
|
||||
packageProductDependencies = (
|
||||
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */,
|
||||
);
|
||||
{{/withSwiftPackageManager}}
|
||||
productName = Runner;
|
||||
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
@@ -208,6 +219,11 @@
|
||||
Base,
|
||||
);
|
||||
mainGroup = 97C146E51CF9000F007C117D;
|
||||
{{#withSwiftPackageManager}}
|
||||
packageReferences = (
|
||||
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */,
|
||||
);
|
||||
{{/withSwiftPackageManager}}
|
||||
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
@@ -619,6 +635,22 @@
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
{{#withSwiftPackageManager}}
|
||||
|
||||
/* Begin XCLocalSwiftPackageReference section */
|
||||
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = {
|
||||
isa = XCLocalSwiftPackageReference;
|
||||
relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
|
||||
};
|
||||
/* End XCLocalSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
productName = FlutterGeneratedPluginSwiftPackage;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
{{/withSwiftPackageManager}}
|
||||
};
|
||||
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,26 @@
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
{{#withSwiftPackageManager}}
|
||||
<PreActions>
|
||||
<ExecutionAction
|
||||
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
|
||||
<ActionContent
|
||||
title = "Run Prepare Flutter Framework Script"
|
||||
scriptText = "/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" prepare ">
|
||||
<EnvironmentBuildable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</EnvironmentBuildable>
|
||||
</ActionContent>
|
||||
</ExecutionAction>
|
||||
</PreActions>
|
||||
{{/withSwiftPackageManager}}
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
@@ -3,6 +3,11 @@
|
||||
#import <XCTest/XCTest.h>
|
||||
{{#withPlatformChannelPluginHook}}
|
||||
|
||||
{{#withSwiftPackageManager}}
|
||||
// If your plugin has been explicitly set to "type: .dynamic" in the Package.swift,
|
||||
// you will need to add your plugin as a dependency of RunnerTests within Xcode.
|
||||
{{/withSwiftPackageManager}}
|
||||
|
||||
@import {{pluginProjectName}};
|
||||
|
||||
// This demonstrates a simple unit test of the Objective-C portion of this plugin's implementation.
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||
{{#withSwiftPackageManager}}
|
||||
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; };
|
||||
{{/withSwiftPackageManager}}
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||
@@ -62,6 +65,9 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
{{#withSwiftPackageManager}}
|
||||
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */,
|
||||
{{/withSwiftPackageManager}}
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -157,6 +163,11 @@
|
||||
dependencies = (
|
||||
);
|
||||
name = Runner;
|
||||
{{#withSwiftPackageManager}}
|
||||
packageProductDependencies = (
|
||||
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */,
|
||||
);
|
||||
{{/withSwiftPackageManager}}
|
||||
productName = Runner;
|
||||
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
@@ -190,6 +201,11 @@
|
||||
Base,
|
||||
);
|
||||
mainGroup = 97C146E51CF9000F007C117D;
|
||||
{{#withSwiftPackageManager}}
|
||||
packageReferences = (
|
||||
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */,
|
||||
);
|
||||
{{/withSwiftPackageManager}}
|
||||
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
@@ -620,6 +636,22 @@
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
{{#withSwiftPackageManager}}
|
||||
|
||||
/* Begin XCLocalSwiftPackageReference section */
|
||||
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = {
|
||||
isa = XCLocalSwiftPackageReference;
|
||||
relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
|
||||
};
|
||||
/* End XCLocalSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
productName = FlutterGeneratedPluginSwiftPackage;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
{{/withSwiftPackageManager}}
|
||||
};
|
||||
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,26 @@
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
{{#withSwiftPackageManager}}
|
||||
<PreActions>
|
||||
<ExecutionAction
|
||||
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
|
||||
<ActionContent
|
||||
title = "Run Prepare Flutter Framework Script"
|
||||
scriptText = "/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" prepare ">
|
||||
<EnvironmentBuildable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</EnvironmentBuildable>
|
||||
</ActionContent>
|
||||
</ExecutionAction>
|
||||
</PreActions>
|
||||
{{/withSwiftPackageManager}}
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
@@ -3,6 +3,11 @@ import UIKit
|
||||
import XCTest
|
||||
{{#withPlatformChannelPluginHook}}
|
||||
|
||||
{{#withSwiftPackageManager}}
|
||||
// If your plugin has been explicitly set to "type: .dynamic" in the Package.swift,
|
||||
// you will need to add your plugin as a dependency of RunnerTests within Xcode.
|
||||
{{/withSwiftPackageManager}}
|
||||
|
||||
@testable import {{pluginProjectName}}
|
||||
|
||||
// This demonstrates a simple unit test of the Swift portion of this plugin's implementation.
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
|
||||
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
|
||||
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
|
||||
{{#withSwiftPackageManager}}
|
||||
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; };
|
||||
{{/withSwiftPackageManager}}
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -92,6 +95,9 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
{{#withSwiftPackageManager}}
|
||||
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */,
|
||||
{{/withSwiftPackageManager}}
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -216,6 +222,11 @@
|
||||
33CC11202044C79F0003C045 /* PBXTargetDependency */,
|
||||
);
|
||||
name = Runner;
|
||||
{{#withSwiftPackageManager}}
|
||||
packageProductDependencies = (
|
||||
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */,
|
||||
);
|
||||
{{/withSwiftPackageManager}}
|
||||
productName = Runner;
|
||||
productReference = 33CC10ED2044A3C60003C045 /* {{projectName}}.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
@@ -260,6 +271,11 @@
|
||||
Base,
|
||||
);
|
||||
mainGroup = 33CC10E42044A3C60003C045;
|
||||
{{#withSwiftPackageManager}}
|
||||
packageReferences = (
|
||||
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */,
|
||||
);
|
||||
{{/withSwiftPackageManager}}
|
||||
productRefGroup = 33CC10EE2044A3C60003C045 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
@@ -700,6 +716,22 @@
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
{{#withSwiftPackageManager}}
|
||||
|
||||
/* Begin XCLocalSwiftPackageReference section */
|
||||
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = {
|
||||
isa = XCLocalSwiftPackageReference;
|
||||
relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
|
||||
};
|
||||
/* End XCLocalSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
productName = FlutterGeneratedPluginSwiftPackage;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
{{/withSwiftPackageManager}}
|
||||
};
|
||||
rootObject = 33CC10E52044A3C60003C045 /* Project object */;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,26 @@
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
{{#withSwiftPackageManager}}
|
||||
<PreActions>
|
||||
<ExecutionAction
|
||||
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
|
||||
<ActionContent
|
||||
title = "Run Prepare Flutter Framework Script"
|
||||
scriptText = ""$FLUTTER_ROOT"/packages/flutter_tools/bin/macos_assemble.sh prepare ">
|
||||
<EnvironmentBuildable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||
BuildableName = "{{projectName}}.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</EnvironmentBuildable>
|
||||
</ActionContent>
|
||||
</ExecutionAction>
|
||||
</PreActions>
|
||||
{{/withSwiftPackageManager}}
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
|
||||
@@ -3,6 +3,11 @@ import FlutterMacOS
|
||||
import XCTest
|
||||
{{#withPlatformChannelPluginHook}}
|
||||
|
||||
{{#withSwiftPackageManager}}
|
||||
// If your plugin has been explicitly set to "type: .dynamic" in the Package.swift,
|
||||
// you will need to add your plugin as a dependency of RunnerTests within Xcode.
|
||||
{{/withSwiftPackageManager}}
|
||||
|
||||
@testable import {{pluginProjectName}}
|
||||
|
||||
// This demonstrates a simple unit test of the Swift portion of this plugin's implementation.
|
||||
|
||||
@@ -13,8 +13,14 @@ Pod::Spec.new do |s|
|
||||
s.license = { :file => '../LICENSE' }
|
||||
s.author = { 'Your Company' => 'email@example.com' }
|
||||
s.source = { :path => '.' }
|
||||
{{#withSwiftPackageManager}}
|
||||
s.source_files = '{{projectName}}/Sources/{{projectName}}/**/*'
|
||||
s.public_header_files = '{{projectName}}/Sources/{{projectName}}/include/{{projectName}}/**/*.h'
|
||||
{{/withSwiftPackageManager}}
|
||||
{{^withSwiftPackageManager}}
|
||||
s.source_files = 'Classes/**/*'
|
||||
s.public_header_files = 'Classes/**/*.h'
|
||||
{{/withSwiftPackageManager}}
|
||||
s.dependency 'Flutter'
|
||||
s.platform = :ios, '12.0'
|
||||
|
||||
|
||||
@@ -13,7 +13,12 @@ Pod::Spec.new do |s|
|
||||
s.license = { :file => '../LICENSE' }
|
||||
s.author = { 'Your Company' => 'email@example.com' }
|
||||
s.source = { :path => '.' }
|
||||
{{#withSwiftPackageManager}}
|
||||
s.source_files = '{{projectName}}/Sources/{{projectName}}/**/*'
|
||||
{{/withSwiftPackageManager}}
|
||||
{{^withSwiftPackageManager}}
|
||||
s.source_files = 'Classes/**/*'
|
||||
{{/withSwiftPackageManager}}
|
||||
s.dependency 'Flutter'
|
||||
s.platform = :ios, '12.0'
|
||||
|
||||
|
||||
@@ -20,7 +20,12 @@ Pod::Spec.new do |s|
|
||||
# `../src/*` so that the C sources can be shared among all target platforms.
|
||||
{{/withFfiPluginHook}}
|
||||
s.source = { :path => '.' }
|
||||
s.source_files = 'Classes/**/*'
|
||||
{{#withSwiftPackageManager}}
|
||||
s.source_files = '{{projectName}}/Sources/{{projectName}}/**/*'
|
||||
{{/withSwiftPackageManager}}
|
||||
{{^withSwiftPackageManager}}
|
||||
s.source_files = 'Classes/**/*'
|
||||
{{/withSwiftPackageManager}}
|
||||
s.dependency 'FlutterMacOS'
|
||||
|
||||
s.platform = :osx, '10.11'
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// swift-tools-version: {{swiftToolsVersion}}
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "{{projectName}}",
|
||||
platforms: [
|
||||
{{iosSupportedPlatform}}
|
||||
],
|
||||
products: [
|
||||
.library(name: "{{swiftLibraryName}}", targets: ["{{projectName}}"])
|
||||
],
|
||||
dependencies: [],
|
||||
targets: [
|
||||
.target(
|
||||
name: "{{projectName}}",
|
||||
dependencies: [],
|
||||
resources: [
|
||||
.process("Resources"),
|
||||
],
|
||||
cSettings: [
|
||||
.headerSearchPath("include/{{projectName}}"),
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,4 @@
|
||||
#import <Flutter/Flutter.h>
|
||||
|
||||
@interface {{pluginClass}} : NSObject<FlutterPlugin>
|
||||
@end
|
||||
@@ -0,0 +1,20 @@
|
||||
#import "{{pluginClass}}.h"
|
||||
|
||||
@implementation {{pluginClass}}
|
||||
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
|
||||
FlutterMethodChannel* channel = [FlutterMethodChannel
|
||||
methodChannelWithName:@"{{projectName}}"
|
||||
binaryMessenger:[registrar messenger]];
|
||||
{{pluginClass}}* instance = [[{{pluginClass}} alloc] init];
|
||||
[registrar addMethodCallDelegate:instance channel:channel];
|
||||
}
|
||||
|
||||
- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
|
||||
if ([@"getPlatformVersion" isEqualToString:call.method]) {
|
||||
result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
|
||||
} else {
|
||||
result(FlutterMethodNotImplemented);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,24 @@
|
||||
// swift-tools-version: {{swiftToolsVersion}}
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "{{projectName}}",
|
||||
platforms: [
|
||||
{{iosSupportedPlatform}}
|
||||
],
|
||||
products: [
|
||||
.library(name: "{{swiftLibraryName}}", targets: ["{{projectName}}"])
|
||||
],
|
||||
dependencies: [],
|
||||
targets: [
|
||||
.target(
|
||||
name: "{{projectName}}",
|
||||
dependencies: [],
|
||||
resources: [
|
||||
.process("Resources"),
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,19 @@
|
||||
import Flutter
|
||||
import UIKit
|
||||
|
||||
public class {{pluginClass}}: NSObject, FlutterPlugin {
|
||||
public static func register(with registrar: FlutterPluginRegistrar) {
|
||||
let channel = FlutterMethodChannel(name: "{{projectName}}", binaryMessenger: registrar.messenger())
|
||||
let instance = {{pluginClass}}()
|
||||
registrar.addMethodCallDelegate(instance, channel: channel)
|
||||
}
|
||||
|
||||
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
switch call.method {
|
||||
case "getPlatformVersion":
|
||||
result("iOS " + UIDevice.current.systemVersion)
|
||||
default:
|
||||
result(FlutterMethodNotImplemented)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// swift-tools-version: {{swiftToolsVersion}}
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "{{projectName}}",
|
||||
platforms: [
|
||||
{{macosSupportedPlatform}}
|
||||
],
|
||||
products: [
|
||||
.library(name: "{{swiftLibraryName}}", targets: ["{{projectName}}"])
|
||||
],
|
||||
dependencies: [],
|
||||
targets: [
|
||||
.target(
|
||||
name: "{{projectName}}",
|
||||
dependencies: [],
|
||||
resources: [
|
||||
.process("Resources"),
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,19 @@
|
||||
import Cocoa
|
||||
import FlutterMacOS
|
||||
|
||||
public class {{pluginClass}}: NSObject, FlutterPlugin {
|
||||
public static func register(with registrar: FlutterPluginRegistrar) {
|
||||
let channel = FlutterMethodChannel(name: "{{projectName}}", binaryMessenger: registrar.messenger)
|
||||
let instance = {{pluginClass}}()
|
||||
registrar.addMethodCallDelegate(instance, channel: channel)
|
||||
}
|
||||
|
||||
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
switch call.method {
|
||||
case "getPlatformVersion":
|
||||
result("macOS " + ProcessInfo.processInfo.operatingSystemVersionString)
|
||||
default:
|
||||
result(FlutterMethodNotImplemented)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,13 +40,13 @@
|
||||
"templates/app_shared/android.tmpl/gradle/wrapper/gradle-wrapper.properties.tmpl",
|
||||
"templates/app_shared/android.tmpl/settings.gradle",
|
||||
"templates/app_shared/ios-objc.tmpl/Runner.xcodeproj/project.pbxproj.tmpl",
|
||||
"templates/app_shared/ios-objc.tmpl/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme",
|
||||
"templates/app_shared/ios-objc.tmpl/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme.tmpl",
|
||||
"templates/app_shared/ios-objc.tmpl/Runner/AppDelegate.h",
|
||||
"templates/app_shared/ios-objc.tmpl/Runner/AppDelegate.m",
|
||||
"templates/app_shared/ios-objc.tmpl/Runner/main.m",
|
||||
"templates/app_shared/ios-objc.tmpl/RunnerTests/RunnerTests.m.tmpl",
|
||||
"templates/app_shared/ios-swift.tmpl/Runner.xcodeproj/project.pbxproj.tmpl",
|
||||
"templates/app_shared/ios-swift.tmpl/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme",
|
||||
"templates/app_shared/ios-swift.tmpl/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme.tmpl",
|
||||
"templates/app_shared/ios-swift.tmpl/Runner/AppDelegate.swift",
|
||||
"templates/app_shared/ios-swift.tmpl/Runner/Runner-Bridging-Header.h",
|
||||
"templates/app_shared/ios-swift.tmpl/RunnerTests/RunnerTests.swift.tmpl",
|
||||
@@ -277,13 +277,9 @@
|
||||
"templates/plugin/android.tmpl/gradle.properties.tmpl",
|
||||
"templates/plugin/android.tmpl/settings.gradle.tmpl",
|
||||
"templates/plugin/android.tmpl/src/main/AndroidManifest.xml.tmpl",
|
||||
"templates/plugin/ios-objc.tmpl/Classes/pluginClass.h.tmpl",
|
||||
"templates/plugin/ios-objc.tmpl/Classes/pluginClass.m.tmpl",
|
||||
"templates/plugin/ios-objc.tmpl/projectName.podspec.tmpl",
|
||||
"templates/plugin/ios-swift.tmpl/Classes/pluginClass.swift.tmpl",
|
||||
"templates/plugin/ios-swift.tmpl/projectName.podspec.tmpl",
|
||||
"templates/plugin/ios.tmpl/.gitignore",
|
||||
"templates/plugin/ios.tmpl/Assets/.gitkeep",
|
||||
"templates/plugin/lib/projectName.dart.tmpl",
|
||||
"templates/plugin/lib/projectName_platform_interface.dart.tmpl",
|
||||
"templates/plugin/lib/projectName_method_channel.dart.tmpl",
|
||||
@@ -292,7 +288,6 @@
|
||||
"templates/plugin/linux.tmpl/pluginClassSnakeCase.cc.tmpl",
|
||||
"templates/plugin/linux.tmpl/pluginClassSnakeCase_private.h.tmpl",
|
||||
"templates/plugin/linux.tmpl/test/pluginClassSnakeCase_test.cc.tmpl",
|
||||
"templates/plugin/macos.tmpl/Classes/pluginClass.swift.tmpl",
|
||||
"templates/plugin/README.md.tmpl",
|
||||
"templates/plugin/test/projectName_test.dart.tmpl",
|
||||
"templates/plugin/test/projectName_method_channel_test.dart.tmpl",
|
||||
@@ -338,6 +333,22 @@
|
||||
"templates/plugin_shared/pubspec.yaml.tmpl",
|
||||
"templates/plugin_shared/windows.tmpl/.gitignore",
|
||||
|
||||
"templates/plugin_cocoapods/ios-objc.tmpl/Classes/pluginClass.h.tmpl",
|
||||
"templates/plugin_cocoapods/ios-objc.tmpl/Classes/pluginClass.m.tmpl",
|
||||
"templates/plugin_cocoapods/ios-swift.tmpl/Classes/pluginClass.swift.tmpl",
|
||||
"templates/plugin_cocoapods/ios.tmpl/Assets/.gitkeep",
|
||||
"templates/plugin_cocoapods/macos.tmpl/Classes/pluginClass.swift.tmpl",
|
||||
|
||||
"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",
|
||||
"templates/plugin_swift_package_manager/ios-objc.tmpl/projectName.tmpl/Package.swift.tmpl",
|
||||
"templates/plugin_swift_package_manager/ios-swift.tmpl/projectName.tmpl/Sources/projectName.tmpl/pluginClass.swift.tmpl",
|
||||
"templates/plugin_swift_package_manager/ios-swift.tmpl/projectName.tmpl/Package.swift.tmpl",
|
||||
"templates/plugin_swift_package_manager/ios.tmpl/projectName.tmpl/Sources/projectName.tmpl/Resources/.gitkeep",
|
||||
"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/skeleton/assets/images/2.0x/flutter_logo.png.img.tmpl",
|
||||
"templates/skeleton/assets/images/3.0x/flutter_logo.png.img.tmpl",
|
||||
"templates/skeleton/assets/images/flutter_logo.png.img.tmpl",
|
||||
|
||||
Reference in New Issue
Block a user