Adding wol plugin
This commit is contained in:
24
wol/ios/Plugin/Info.plist
Normal file
24
wol/ios/Plugin/Info.plist
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
8
wol/ios/Plugin/wol.swift
Normal file
8
wol/ios/Plugin/wol.swift
Normal file
@@ -0,0 +1,8 @@
|
||||
import Foundation
|
||||
|
||||
@objc public class wol: NSObject {
|
||||
@objc public func echo(_ value: String) -> String {
|
||||
print(value)
|
||||
return value
|
||||
}
|
||||
}
|
||||
10
wol/ios/Plugin/wolPlugin.h
Normal file
10
wol/ios/Plugin/wolPlugin.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
//! Project version number for Plugin.
|
||||
FOUNDATION_EXPORT double PluginVersionNumber;
|
||||
|
||||
//! Project version string for Plugin.
|
||||
FOUNDATION_EXPORT const unsigned char PluginVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
|
||||
|
||||
8
wol/ios/Plugin/wolPlugin.m
Normal file
8
wol/ios/Plugin/wolPlugin.m
Normal file
@@ -0,0 +1,8 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Capacitor/Capacitor.h>
|
||||
|
||||
// Define the plugin using the CAP_PLUGIN Macro, and
|
||||
// each method the plugin supports using the CAP_PLUGIN_METHOD macro.
|
||||
CAP_PLUGIN(wolPlugin, "wol",
|
||||
CAP_PLUGIN_METHOD(echo, CAPPluginReturnPromise);
|
||||
)
|
||||
18
wol/ios/Plugin/wolPlugin.swift
Normal file
18
wol/ios/Plugin/wolPlugin.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
import Foundation
|
||||
import Capacitor
|
||||
|
||||
/**
|
||||
* Please read the Capacitor iOS Plugin Development Guide
|
||||
* here: https://capacitorjs.com/docs/plugins/ios
|
||||
*/
|
||||
@objc(wolPlugin)
|
||||
public class wolPlugin: CAPPlugin {
|
||||
private let implementation = wol()
|
||||
|
||||
@objc func echo(_ call: CAPPluginCall) {
|
||||
let value = call.getString("value") ?? ""
|
||||
call.resolve([
|
||||
"value": implementation.echo(value)
|
||||
])
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user