adding packages
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
#import <Flutter/Flutter.h>
|
||||
|
||||
@interface GetVersionPlugin : NSObject<FlutterPlugin>
|
||||
@end
|
||||
@@ -0,0 +1,8 @@
|
||||
#import "GetVersionPlugin.h"
|
||||
#import <get_version/get_version-Swift.h>
|
||||
|
||||
@implementation GetVersionPlugin
|
||||
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
|
||||
[SwiftGetVersionPlugin registerWithRegistrar:registrar];
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,30 @@
|
||||
import Flutter
|
||||
import UIKit
|
||||
|
||||
public class SwiftGetVersionPlugin: NSObject, FlutterPlugin {
|
||||
public static func register(with registrar: FlutterPluginRegistrar) {
|
||||
let channel = FlutterMethodChannel(name: "get_version", binaryMessenger: registrar.messenger())
|
||||
let instance = SwiftGetVersionPlugin()
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension Bundle {
|
||||
var releaseVersionNumber: String? {
|
||||
return infoDictionary?["CFBundleShortVersionString"] as? String
|
||||
}
|
||||
var buildVersionNumber: String? {
|
||||
return infoDictionary?["CFBundleVersion"] as? String
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user