mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

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 ```
21 lines
714 B
Cheetah
21 lines
714 B
Cheetah
#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
|